The form is created using HTML and validation and processing of the form’s contents is done with PHP.
The goal is to teach you some basic HTML form elements and how their data is accessible to you in your PHP scripts.
All of this code would be placed towards the top of the page before the HTML for the form: The exception is the brochure checkbox which does not need to be validated as it is an optional field.
The loop would generate the HTML for the options on the fly, and the check if the option has been selected or not can be incorporated into it. It’s just one of those minor inconsistencies we have to live with.To determine whether the form has been submitted by the user, either check the request method (an example follows in the next section) or check for the presence of a specific form control (usually the submit button).Whichever method you use, if the form has been submitted, it should be validated.Browsers that support HTML5 email address validation include Safari 5 , Google Chrome 6 , Mozilla Firefox 4 and Opera 10 .Safari 5 and Google Chrome 6-8 will not accept invalid email address input but, unlike the other browsers, will not help the user correct the error.