When you submit a form to a CGI program that resides on the server, it is usually programmed to do its own check for errors.
If it finds any it sends the page back to the reader who then has to re-enter some data, before submitting again.
We're going to be checking the form using a function, which will be activated by the form's Validating this form would be considerably simpler than one containing radio buttons or select boxes, but any form element can be accessed.
When you are asking a reader for their email address, you can use a simple » address validation function to make sure the address has a valid structure. Each option in a drop-down box is indexed in the array Annoyingly, there is no simple way to check which radio button out of a group is selected — you have to check through each element, linked with Boolean AND operators .
When checking a particular form field, we call it by the name and check its value.
Shows you how to write a script that ensures your form is filled in correctly before it's sent to your server.
The truth is that none of us filling in forms — there is a lot of evidence to show that users get annoyed by forms, and are one of main things that will cause them to leave and go somewhere else if they are done badly. We want to make filling out web forms as non-horrible as possible, so why do we insist on blocking our users at every turn?
There are three main reasons: In the real world, developers tend to use a combination of client-side and server-side validation, to be on the safe side.