Validating Values
It’s not enough to know which technique should be used to process form input; you also need to know what sorts of things you can validate in form fields. In the sample script, I checked to make sure that the user entered something in each of the fields. That sort of check is better than nothing, but it doesn’t really do much to ensure that the user entered the type of data that you expected in the field.
In some cases, validation beyond making sure that the field is populated is unnecessary. For example, if you’re just letting users enter feedback about the Web site, it’s not so important what they enter in the form field for comments. Or, such a wide variety of values is allowed that there’s no reliable way to make sure that ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access