PHP form validation sample. This tutorial goes through how to implement validation with PHP in a form and pre-populate the form if there is an error. If you program custom PHP applications, you will often times need to work with a form and require certain form fields. A few real world examples would be a contact form, registration form or signup form. This tutorial shows you a simple and quick method for creating a form page that handles errors and pre-populates fields if there is an error, and a method for processing the form and validating the information.