So far, we have a largely HTML page which defines the form; the only PHP so far is to specify the form’s action value.We need to add code which will pick up the form data and allow us to check it and create error messages if needed.

Whichever method you use, if the form has been submitted, it should be validated.

If it has not been submitted, bypass the validation and display a blank form.

These inputs will be validated to ensure, for example, that the user has entered their name. This is because collectively the radio buttons should be treated as a group (the user should select either 0, or 1, or 2, etc.). Its value is presented as its label, and clicking on it will trigger the form submission.

Any errors or omissions will be highlighted with a message alongside the relevant field. The purpose of the form is to capture user details (name, address, and email) to obtain feedback (on fruit consumption and favorite fruit) and request a brochure. There are two specific attributes that need to be set in the form tag, .

For further information on And if you enjoyed reading this post, you’ll love Learnable; the place to learn fresh skills and techniques from the masters.

Members get instant access to all of Site Point’s ebooks and interactive online courses, like Jump Start PHP.He now teaches and has acquired a Masters degree in Internet Systems Development as well as a teaching qualification.Iain's specialized areas of teaching is web technologies, mainly programming in a variety of languages, HTML, CSS and database integration. Now you can ask questions directly to me on my new site ASPForums. Net Question Answer site, specially started to allow visitors of this site ask their doubts and queries. Just click the Ask Now button and ask your question now.In this article you’ll construct and validate a simple form using HTML and PHP.