In the previous recipe, we learned how to create a form so that users can submit data to the server. However, we didn't validate the data, and thus, it allows users to submit anything including invalid data, such as an invalid e-mail address or date.
The reason to validate data submitted by users is not only to prevent the application crashing from being fed data in an invalid format—for example, sending an email to an invalid e-mail address—but also for security reasons.
We are going to improve the code from the previous recipe by adding validation to the form we've created. You can duplicate the project to keep the previous section's code unmodified or you can modify it.
Carry out the following steps ...