Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Adding forms to your website is done pretty easily using Dreamweaver. As you can see here on the contact page, I've added a couple of text fields right here, and even a text area component and a Submit button, ultimately making up this contact form. So you can add these components using Dreamweaver, but what happens when you hit that Submit button? Well, it needs to send that data to an email address, as it needs to send that data to a middleware page that does the processing.
Usually it's a PHP page or a Perl script, and that middleware page is usually provided by your hosting company. So I'm going to go to my hosting company. It happens to be godaddy.com, not that I'm promoting them. I just want to point out what they have available to you. Under Tools, there is this Form Mail. So any form that is created on your site will send that data to this email address using GoDaddy. So that they make it really easy; just enter in your email, and that's good to go there.
So, check with your hosting company, see if they have some sort of form script available to you, and if they don't, I have actually provided a page for you, so you can also see what it looks like. So I'm going to go into Dreamweaver. Here, I'm in Dreamweaver. Here's my form. Everything is looking good. But I want to open up that page that I have provided in case you have access to the source files, formmail.php. I'm going to open up this page. Notice how you don't see anything because you need to click over to Code view, and you can see all of the code.
So in this case, this just provides a couple different options in here that will work out great for processing. Notice that as I scroll down, you have these three different lines that will send the name, email, and message to this email address--again the same one that was part of my GoDaddy site. Here's the subject line and then the header. We'll include the name and email, and then the body of the message will be the name, email, and comments being submitted.
So that's how that works. Also, there's a thank you page that it will return to. So, that's what I want to go ahead and implement are this form ultimately, but I need to point to it first. So I'm going to go to contact.html. Remember, this is an entire form, and that form is encapsulated right here by this red line. It shows me that form, and right down in here, I need to point to that specific page, evajonesdesign.com, and that is known as formmail.php.
Now keep in mind, this page, this formmail.php page, is already uploaded. With that in place, what's going to happen is--in fact, as I save this page, I can preview it in a browser, and we can test this out. My name, email address, hitting the Tab key, Love your site! clicking the Submit button. Let's see what's going to happen. Clicking on that.
Oh, it takes me to this thank you page. I am like, wait a minute. I don't have a thank you page. Well, you are right, because this is basically their 404 Error page that GoDaddy has. So I need to create a thankyou page. But let's click over to the evajonesdesigner email account and see if we've received that email. So clicking over into this Gmail account. And here I am in evajonesdesigner email. Right in here, I can click right here from EvaJonesDesign. Here's the message, Love your site! is really what I sent.
So hopefully, that's pretty straightforward. There are really only three fields in here: your Name, Email and Comments. You can see what it says. I can reply as Eva Jones if I want to. But that's how that works. Going back into Dreamweaver, what I need to do is I need to create that thank you page after you hit the Submit button. Because if I take a look at that formmail.php, you can see, right up here on line 5, it says hey, you know what, the refresh takes you to that thankyou.html. So I'm going to make that right now. Starting with the contact page, I'm going to do a Save As, and I'm going to save this as, you guessed it, thankyou, right there. And I need to delete this form as well as this other content, say right here instead of Let's connect, Thank you for contacting me, just a simple message just like that, eliminating that line too.
Now with that in place, I can save this page. So this page would need to be uploaded as well. Once this page is uploaded, I can go to my contact form. In fact, let's just preview this in a browser and try this one more time: your name, email address, message. When I click Submit, it's going to go to that thankyou.html page that is already uploaded.
So the uploading will actually happen in another step, but nonetheless, as you get into hosting, that's where I'll talk about that. But with that page uploaded, if I click Submit, it actually goes to that thank you page and sends that message as well. So that's how you deal with the processing of any form data and ultimately sending it to an email, either using what your hosting company provides or using that formmail.php, modifying it accordingly, and then uploading that to your site, as well as uploading a thank you page.
Get unlimited access to all courses for just $25/month.Become a member