Contact Form Processing Products - for all your needs

FormMail • Form Encryption • Hosted Forms

Redirecting the User

This How-To guide explains how to redirect the user to a custom URL after they've submitted your form.


All versions of FormMail display a default page to the user if you don't specify something else.

There are two possible outcomes to a user's form submission:

  • Success; or,
  • Failure

Static Pages

In the case of a successful form submission, FormMail defaults to a generic "Thank you" page. In the case of a failed form submission, FormMail defaults to a generic error page.

You can choose a different page by specifying a URL with "good_url" and "bad_url" fields, for success, and failure, respectively.

Like this:

<input type="hidden" name="good_url"
       value="" />
<input type="hidden" name="bad_url"
       value="" />

These are hidden fields that you add to your HTML form. You don't need to change the PHP code in FormMail to get redirection to work.

Template Pages

The "good_url" feature provides you with a static results page. If you'd like to show some of the information the user submitted, you can use a field called "good_template".

To do this, you need to set the TEMPLATEDIR or TEMPLATEURL setting in FormMail's configuration. Also, download the Sample Good Template and read the instructions in there.

There's a similar feature for error handling called "bad_template". However, error handling is more complicated so we've provided a separate How-To guide on Advanced Error Handling.