Form data validation
register global is OFF so we will be taking special care to collect data at different pages.
We will also be using header redirection for sending back the visitor to thank you page ( after successful validation ) or back to from with error message once the validation fails.
There are three pages in the script. The form.php page displays the form. This page also receives all the post back data and create the default values of the components. We need not discuss here again how that is done, you can read all the individual form component validations here, with link to different section.
form-check.php checks the form input and does the validation. If the validation passes then it redirect to form-thank.php otherwise it sends back to form.php page with the post back data.
form-thanks.php only display the thank you message.
Download the full script of form validation
Subscribe to our Youtube Channel here
This article is written by plus2net.com team. https://www.plus2net.com
|▼ Web Forms & handling data in PHP|