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: Appropriate input

Form validation: Appropriate input - PHP Tutorial

From the course: Learning PHP

Start my 1-month free trial

Form validation: Appropriate input

- [Instructor] Another type of validation you'll want to do on the server is making sure that data submitted is appropriate data. For example, you'll want to make sure the email address is an actual email address. Luckily, browsers do a lot of this for us now if we use the right input type. For example, the email input type will validate an email address before the form is submitted. But this is still worth knowing how to do. The way you'd accomplish this is by comparing the input to a description of what the input should look like. These descriptions are called regular expressions or RegEx for short. Now, diving deep into RegEx is a bit beyond the scope of this course, but I do want to show you an example of what that might look like. First we have our regular expression or a description of an email string. Now this looks complicated, but it's basically searching for any alphanumeric string of any length, followed by an…

Contents