Developer Support »

Redirecting to form page to show errors using REFERER  (See more user questions)

Hi .

Thank you for your interesting question.

The script will handle that with a slight adjustment (shown below) presuming
you want all the forms processed the same way, i.e. all going to the same
address with the same subject line and the same required fields etc etc.

Would you want each form to be processed differently? By default the script
won't do that, you would need one copy of the script for each form (not
viable in your case) to do that, but I could give you snippets of code that
would allow it to handle certain hidden inputs to vary the processing on a
per-form basis.

You would need to code your form to show the errors on it, see this page on
my support section:

https://formtoemail.com/developersupport/show_errors_on_form_page.php

Also, your form pages need to be PHP to display the errors.

Normally in the script when processing just one form and showing the errors
on the form page, you would set the URL of the form page so the script knows
where to redirect the visitor in the event of an error, using this
configuration option:

$form_page_url = "http://example.com/contact.php";

You could change the line of code to this:

$form_page_url = $_SERVER['HTTP_REFERER'];

...which would send your visitor back to the page they came from, i.e. the
appropriate form page in your case.

Might be better just to show the errors on the script without redirecting
back to the form page...save a lot of hassle. Bear in mind if you are
redirecting to the form page, it is highly desirable to prepopulate it with
the submitted values. See this page on my support section:

https://formtoemail.com/developersupport/pre_populate_form.php

That said, if you only have one form which is being included, might be quite
straight-forward for you.

More information on customising the default error messages in the script,
here:

https://formtoemail.com/developersupport/customizing_error_messages.php

Any questions, just let me know.

Best wishes.

Charles Sweeney
https://formtoemail.com
The world's easiest feedback script!

----- Original Message -----
Sent: Thursday, August 26, 2010 2:03 AM
Subject: FormToEmail script


> Comments: Question:
>
> I have hundreds of .htm pages with an embedded PHP include registration
> form that needs one one common processing script, with errors reported on
> each/all .htm pages like your bottom example. Can this script handle that,
> or only one page processed at a time in the script?
>
> Tx!