Support »

Auto-redirect with posted form values

Applies to Pro Plan users only

As an alternative to simply redirecting to another page, or using the default "thank you" message, you can redirect to a page that can show some, all, or none of the submitted form values when the form has been successfully sent.

To use this option, you will need to enable it on the Form Configuration page (of the desired form) within the User Panel. The option to enable is called "Auto Redirect With Post". In addition, you will also need to enter the URL of the page to you would like to redirect to, enter this URL in the field titled "Redirect URL".

The benefit of using this redirect is that you can display submitted form values on the page that you redirect to. To do so, the page needs to be a "dynamic" page like PHP or ASP (PHP instructions are shown below). You cannot show the submitted form values on a static page like an HTML page (e.g .htm, .html).

The system uses an automated POST function to take your visitor to the "thank you" page when they have successfully submitted your form. The submitted form values are also sent with the POST function and are available to the resultant page.

Displaying the submitted form values

If you are new to working with PHP code, have a look at the Editing PHP Code item in the Support section.

To display the submitted form values on the "thank you" page, you need to put some PHP code on the page. The page can consist of PHP code only, or a mix of PHP and HTML code (the latter being the norm). At a point in your page BEFORE you want to show the submitted form values, add this PHP code:


foreach(array_keys($_POST) as $key){if(!is_array($_POST[$key])){$_POST[$key] = stripslashes(urldecode($_POST[$key]));}else{foreach(array_keys($_POST[$key]) as $key2){$_POST[$key][$key2] = stripslashes(urldecode($_POST[$key][$key2]));}}}


Then after that, at a point in the page where you want to show a submitted form value, use this code:

<?php if(isset($_POST['form_field'])){print $_POST['form_field'];} ?>

Replace 'form_field' with the EXACT name of the field on your form. So for example, if you have an address input on your form like this:

<input type="text" name="Address">

...and you wanted to show it on the "thank you" page, you would use this code:

<?php if(isset($_POST['Address'])){print $_POST['Address'];} ?>

Dealing with array inputs

You might have an array input on your form, like this:

<input type="checkbox" name="fruit[]" value="apple">Apple
<input type="checkbox" name="fruit[]" value="orange">Orange
<input type="checkbox" name="fruit[]" value="banana">Banana

The above code is for checkboxes that all have the same name "fruit". The square brackets after the name denotes that the input is an array. You might also have this on a multiple select input. If the name has got square brackets, it's an array.

These are dealt with differently as the array can have more than one value. One way to display these is to write code for every value of the array, like this:


if(isset($_POST['fruit']) && in_array("apple",$_POST['fruit'])){print "apple<br>";}
if(isset($_POST['fruit']) && in_array("orange",$_POST['fruit'])){print "orange<br>";}
if(isset($_POST['fruit']) && in_array("banana",$_POST['fruit'])){print "banana<br>";}


In the above example, if all three were checked, they would appear on the "thank you" page, like this:


Another way to deal with array inputs is to print them using the PHP foreach() construct, which is particularly useful for arrays with a lot of values. To achieve the same output as above, use this code:

<?php if(isset($_POST['fruit'])){foreach($_POST['fruit'] as $value){print $value . "<br>";}} ?>

Example "thank you" page

Here is an example of a PHP and HTML "thank you" page that will display the name, email and comments fields from these form inputs:

<input type="text" name="name">
<input type="text" name="email">
<textarea name="comments"></textarea>

The "thank you" page code:


foreach(array_keys($_POST) as $key){if(!is_array($_POST[$key])){$_POST[$key] = stripslashes(urldecode($_POST[$key]));}else{foreach(array_keys($_POST[$key]) as $key2){$_POST[$key][$key2] = stripslashes(urldecode($_POST[$key][$key2]));}}}


<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Thank You</title>
<link rel="stylesheet" type="text/css" href="/style.css">


<p>Hi <?php if(isset($_POST['name'])){print $_POST['name'];} ?>. Thank you for contacting us.</p>

<p><strong>The information you submitted, is shown below:</strong></p>

<strong>Name:</strong> <?php if(isset($_POST['name'])){print $_POST['name'];} ?><br />
<strong>Email address:</strong> <?php if(isset($_POST['email'])){print $_POST['email'];} ?><br />
<strong>Comments:</strong> <?php if(isset($_POST['comments'])){print $_POST['comments'];} ?>

<p>Any questions, just let us know.</p>


If your visitor entered the name "Bob", the email "[email protected]" and the comments "Can you please send me more information about Product B?", the above page would display like this:

Hi Bob. Thank you for contacting us.

The information you submitted, is shown below:

Name: Bob
Email address: [email protected]
Comments: Can you please send me more information about Product B?

Any questions, just let us know.