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

Solution: Process a simple form and send the email - PHP Tutorial

From the course: Learning PHP

Start my 1-month free trial

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…

Contents