One question we're frequently asked is how to redirect users to a URL or website, after they've successfully submitted a form. By using Convert Forms, it's a very simple process.
In this article, we'll also share how to conditionally send the visitor to a different page depending on the options they select in your form. This means you can send them to the promotion landing page that best suits their interests.
Enable Form Redirection
First, you'll need to have Convert Forms installed, as well as a form created. You'll also need to have created the redirect page or know the URL that you want to redirect users to.
Open your form and click to open the Submissions panel from the left. Next, select Redirect User from the 'Successful Submission Action' dropdown and set the URL you'd like to send the visitor to in the 'Redirect URL' option that appears below.
Finally, you are given an option to also send the form data to the Redirect URL. If you Enable this option then the form data will be available as appended GET parameters.
Conditional Redirects Based On Form Fields
With Convert Forms you can also redirect users to different pages or URLs, depending on what information they select and submit within the form.
First, follow the steps described in the Enable Form Redirection section and set a default redirection URL.
Next, edit and place the following PHP snippet into the PHP Scripts -> After Form Submission option.
// Get the value of the field you'd like to check
$value = $submission->params['YourTextFieldName'];
// Redirection option 1
if ($value == 'YOUR_VALUE_1')
{
$submission->form->successurl = 'https://site.com/page1';
}
// Redirection option 2
if ($value == 'YOUR_VALUE_2')
{
$submission->form->successurl = 'https://site.com/page2';
}
The PHP code above reads the value of the YourTextFieldName field and depending on its value, sets the redirect URL to the $submission->form->successurl property. Make sure you've replaced the YourTextFieldName with your field's name before using it.
For more details on using PHP Scripts in Convert Forms, check out our documentation.