Viewers: in countries Watching now:
Forms perform an essential function in modern websites, making it possible to gather information from users and validate that information. In this course, Adobe Certified Expert Candyce Mairs shows how to create forms to email user information and validate user data using various methods of form validation. These validation methods include client-side, server-side, and custom validation; CAPTCHA images; and Spry validation fields. You'll also see how to set up a PHP testing environment and preview PHP pages in Dreamweaver. Along the way you'll build your skills in areas like using admin consoles, commenting code, working with variables and includes, and much more.
Now I want to show you how to build the actual PHP information that's going to create the email, and I have a file in here, an extra file in the Chapter Seven start course files. So if you do not have those presently, please replace the scuba vac files folder inside of either zamp or mamp in the HT docs folder. Please replace your version of that folder with the chapter seven start version.
There are a few additional files that have been added within the chapter seven start files, and those are the ones I'm going to be talking about. I'm going to open up a file called testemail.php. And we're just going to look at the code on this page, but here is how you can use this file. I put this in the Course files. This is an accurate working model of sending an email.
The idea is you get this on your server, you enter your email address in two locations. Enter it here and enter it here and all you have to do on your web server is open this file in the browser and you should receive an email with a subject of test and the body of the email should say this is a test email. This file will allow you to test and make sure that the email is working on your web server. The reason I'm doing that is because in a local host environment. In a development environment like we are working in. Testing emails usually does not work.
The web server is what sends an email. It is not PHP that sends the email. So this message you're looking at is simply gathered up by PHP. And forwarded using the mail function. This is forwarded to the male transport agent, or MTA. Within your web server and that portion is what actually sends the email. So PHP doesn't have direct contact with the email portion, it's the web server that actually sends the email.
So this file will give you a chance to test your email make sure you're actually receiving your email, before you take a look at the Contact Us form. Now, there are a lot of things that can occur, in trying to send an email. A lot of issues, things such as spam filters, can prevent an email from being received. And your SMTP server, your web server itself, may have to be configured. So our local environment, we cannot use to test emails, or at least not accurately.
So your development environment, if you open this file in the browser, nothing will happen. If you put this on a live web server thats actually functioning and has an smtp server set up within it this will work perfectly. So actually sending thee email is a difficult process in the development environment and what you're going to want to do is get it onto a live web server in order to accurately test it. So here's a very basic form. All this code is correct.
If this does not email, then there's something wrong on the web server side. But do not try and do this in the local environment. Now, this particular feature, what we're doing is setting up our To, Subject, Body, the headers is going to list who this is from. And this is what actually puts the email message together. So this mail function has four pieces separated by commas and your standard php semicolon at the end. This goes inside of php tags.
So the php email portion It's pretty simple. It's really just this line of code. Every other line of code is building those different pieces within this parentheses area. When we look at our Contact Us final form version, this same mail function will be working. But it will be populated with the form data, so we'll take a look at that in another movie. Just note, this test email can used, make sure you put your email address in line two, where it says to do so, and line three, where it says to do so between the quotes.
The double quotes specifically. If you run this and you get an email, your email system is working correctly so your Contact Us final version from the scuba vacations website, if you put that on your server it should work correctly as well.
There are currently no FAQs about Dynamic Dreamweaver Websites: Creating and Validating Forms.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.