From the course: Learning PHP
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution: Process a simple form and send the email - PHP Tutorial
From the course: Learning PHP
Solution: Process a simple form and send the email
(bright music) - [Instructor] All right, time to look at the solution. Now we're not going to type this one out line by line because there's a lot to cover and you can get this entire working file in the exercise files, but there are a few things worth pointing out. First, I assign all of the data to a new array called form data just to keep it safe and sound in case something happens to post. Not totally necessary, but a practice that I started doing a long time ago. Second is we have our form is complete variable. Now we could set it to null but that's going to cause a lot of issues. So what we're doing first is we're seeing if the form has been filled out at all. If empty post, then the form is not complete and we can set it to false. However, if the form has been filled out, we'll set this to null with the understanding that during our required checks, the form is complete, variable could be set to false. If…
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
-
(Locked)
Handling basic form elements3m 37s
-
(Locked)
Handing multiple-choice elements4m 44s
-
(Locked)
Form validation: Making sure required fields are filled in7m 8s
-
(Locked)
Form validation: Appropriate input4m 14s
-
(Locked)
Form validation: Sanitizing input9m 5s
-
(Locked)
Sending the form data in an email7m 9s
-
(Locked)
Challenge: Process a simple form and send the email42s
-
(Locked)
Solution: Process a simple form and send the email4m 24s
-
-
-