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 - PHP Tutorial
From the course: Learning PHP
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
GET vs. POST3m 29s
-
Handling basic form elements3m 37s
-
Handing multiple-choice elements4m 44s
-
Form validation: Making sure required fields are filled in7m 8s
-
Form validation: Appropriate input4m 14s
-
Form validation: Sanitizing input9m 5s
-
Sending the form data in an email7m 9s
-
Challenge: Process a simple form and send the email42s
-
Solution: Process a simple form and send the email4m 24s
-
-
-