Developer Support »

Showing submitted form data on the "thank you" page

If using FormToEmail-Pro (see below for the free script) instead of using the standard "thank you" message built into the script or redirecting to another page, you can use an HTML template to display a "thank you" message of your own design. This "thank you" page will be displayed on the screen when the form is submitted successfully. The biggest advantage of this method is that you can include submitted values from your form in the page, and you can make the page EXACTLY as you want it. To use this option, you need to make an HTML template file, which you upload to your webspace, then enable the $thank_you_message_template option in the script.

The HTML template file is a normal HTML file, with the addition of some, none, or all of the submitted form values in it. If it suits your purpose, you can make the file without showing any of the submitted form values. Write the file as you would any HTML page. Where you want to show a submitted form value in the file, use ff<form_field> (replace "form_field" with the name of the submitted form field you want to show). Like this for example:

<b>State:</b> ff<state>

The above example will print your visitor's state as entered in the state input <input type="text" name="state"> on your form (for example).

You might want to pre-populate a form on your "thank you" page, like a PayPal button for example. This is how you would pre-populate a hidden form input:

<input type="hidden" name="item_number" value="ff<item_number>">

Save the HTML template file by the name shown in the $thank_you_message_template_filename configuration in the script (default: thank_you_message_template.php) then upload it to your webspace in the same directory/folder as the script (default location for it).

For more information on making an HTML template, see the "Email templates" page on the support section about using an email template, which works in the same way (note that you do not need to enable $html_format for this to work).

Quick and simple alternative to using a template

This is a quick and simple way to display the submitted form data in the script's built-in "thank you" message. It will work in most cases (not recursively). It is NOT meant to be the last word on the subject, it is provided should it be of some use to you. It will NOT work if you are using the autoredirect to a "thank you" page (Pro version).

Free version

Open the script (FormToEmail.php) in a text editor. Locate this code at the bottom:

<center>
<b>Thank you <?php if(isset($_REQUEST['name'])){print stripslashes($_REQUEST['name']);} ?></b>
<br>Your message has been sent
<p><a href="<?php print $continue; ?>">Click here to continue</a></p>
<p><b>FormToEmail</b> by <a href="https://formtoemail.com">FormToEmail.com</a></p>
</center>

Replace it with this code:

<b>Thank you <?php if(isset($_REQUEST['name'])){print stripslashes($_REQUEST['name']);} ?></b>
<br>Your message has been sent
<p>Here is the data you submitted:</p>
<?php foreach($_REQUEST as $key => $value){print "<b>{$key}:</b> ".stripslashes(nl2br($value))."<br>";}?>
<p><a href="<?php print $continue; ?>">Click here to continue</a></p>
<p><b>FormToEmail</b> by <a href="https://formtoemail.com">FormToEmail.com</a></p>

Save the file and upload it to your server.

Pro version

Open the script (formtoemailpro.php) in a text editor. Locate this code at the bottom:

<center>
<b>Thank you <?php if(isset($_REQUEST['name'])){print stripslashes($_REQUEST['name']);} ?></b>
<br>Your message has been sent
<p><a href="<?php print $continue; ?>">Click here to continue</a></p>
</center>

Replace it with this code:

<b>Thank you <?php if(isset($_REQUEST['name'])){print stripslashes($_REQUEST['name']);} ?></b>
<br>Your message has been sent
<p>Here is the data you submitted:</p>
<?php foreach($_REQUEST as $key => $value){print "<b>{$key}:</b> ".stripslashes(nl2br($value))."<br>";}?>
<p><a href="<?php print $continue; ?>">Click here to continue</a></p>

Save the file and upload it to your server.