Forums

Conditional Redirection

LearningCompany 16 Mar, 2012
Hi there

How would I go about redirecting the user depending on the choice they've made in the form?

I'm building an Event Registration Form and I'd like to give them the choices 'invoice me' or 'pay now'. If they choose 'pay now' they should be redirected to a payment page.

Thanks in advance
Andi🙂
GreyHead 16 Mar, 2012
Hi LearningCompany,

Here's the simplest solution
<?php
if ( $form->data['some_input'] == 'pay now' ) {
  $mainframe->redirect('some_url');
}
?>
That will do a simple redirect if you add the correct values for the input name and URL.

More complex switching is possible if you need it.

Bob
LearningCompany 19 Mar, 2012
Thanks for that Bob. Sorry for the silly question - but where exactly should I put this code?
GreyHead 19 Mar, 2012
Hi LearningCompany,

In a Custom code action at the point in the process flow (the sequence of actions in the On Submit Event) where you want to do the redirection.

Bob
This topic is locked and no more replies can be posted.