From the course: Learning PHP

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Form validation: Making sure required fields are filled in

Form validation: Making sure required fields are filled in - PHP Tutorial

From the course: Learning PHP

Start my 1-month free trial

Form validation: Making sure required fields are filled in

- [Instructor] Form validation is mostly handled with HTML and JavaScript these days. But it's still important to make sure you're getting proper data on the backend because people could have JavaScript turned off or they could be using an older browser or the browser validation might not validate the same way you want to validate. So the first way to validate on the backend is to make sure all required fields are filled out and we're going to do this in line so that we can give the user the proper message right next to the form field instead of making them go to a different page, telling them the form wasn't right and then having them have to go back to the page. So I have removed the action here and then you'll also notice that we have the HTML5 attribute for required. So it's going to take a little bit of trickery to make sure that we are getting test data that we can make sure is valid. So the first thing I'm…

Contents