Validating forms in html
So now instead of typing the same code for each of our input fields we simply check each $_POST variable with the check_input function and that's it.
Lisa Wollin Microsoft Corporation May 2004 Applies to: Microsoft® Office Front Page® 2003 Microsoft Front Page 2002 Microsoft Front Page 2000 Summary: Learn how validate HTML form fields using Java Script in Microsoft Office Front Page 2003.
The CGI script is still more reliable, as it always works regardless of whether Java Script is enabled on the client-side or not; but having this extra safety barrier is a nice thing to have in place.
It makes your page much more user-friendly, and takes out the frustration of having to fill out the same form repeatedly.
For example, you may want to ensure that someone inserts a valid e-mail address into a text box, or perhaps you want to ensure that someone fills in certain fields.
If you use the following script and Perl source you will know how to validate an entire form at once, displaying a series of error messages that your reader can then go back and fix.