13.3 Form Validation
You now know how to access form data; further processing, such as saving in a database, is covered in other chapters of this book. However, there is another important application for large websites in connection with forms: the validation of form data. Very often, only fully completed forms make sense, such as forms for registration. In addition, some form entries are subject to certain conditions, such as for email addresses, which (to put it very simply) must contain exactly one @ sign. In a web agency, this is the be-all and end-all for a developer, which is why we have added a few checks to our form at this point.
A $ok variable is used for the check. This initially has the value true but is changed to false if an ...
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