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.
Sending the form data in an email - PHP Tutorial
From the course: Learning PHP
Sending the form data in an email
- [Instructor] Once you have your data nice and valid, it's time to do something with it. A common action is sending it via email somewhere. Let's take a look at how to do that now. For simplicity's sake, again, we're going to use a blank process.PHP file, and we're going to assume all of our data has been validated and sanitized. We want to focus on using the mail function in PHP right now. And the easiest way to send email via PHP is the mail function. The mail function accepts several arguments, but the first three are required. It's a two email address where we are sending the message, a subject line, and then the actual body of the email. So let's look at those first. First, let's put together the message, and we're actually going to use some code that we saw in a previous video. You can find this code in the eight three exercise files. But this is going to do everything we need it to do except instead of echo,…
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
-
-
-