dreamweaver/courses/in/london - emailing form responses

Forum home » Delegate support and help forum » Dreamweaver Training and help » dreamweaver/courses/in/london - Emailing Form Responses

dreamweaver/courses/in/london - Emailing Form Responses

resolvedResolved · Low Priority · Version Standard

Vanessa has attended:
Dreamweaver MX Introduction course
Dreamweaver MX Intermediate course

Emailing Form Responses

Hi

Thanks for this great opportunity of some support. I want to create a response form on my site and have the information completed emailed to me. How do I acheive that?

Thanks

Server side scripting

Hi Vanessa,

No problem, it's our pleasure.

As you would have learnt how to create a form in our Dreamweaver Intermediate course, I assume you can make a form with all the elements you require (like text fields, drop-down boxed etc.)

You can put "mailto:yourname@domain.com" in the ACTION part of your form to get the data sent, but your e-mail will be unformatted, the visitor will see one of more security messages and it looks very unprofessional.

While anyone can create a form in Dreamweaver, to take proper "action" on the data submitted requires some kind of CGI or 'server side' script.

There are many free services out there, such as bravenet who can supply with you step-by-step instructions on adding a simple form to your web site, using their server and CGI files. I have used bravenet in the past, and have been very satisfied. It's all free. Another one is MyContactForm, which I haven't used.

Your web site hosting provider may also have an e-mail form feature that may be included in your account, or available to upgrade for a small fee (either once off, or per billing period).

If you want more flexibility, and hence wanted to do the processing, formatting and sending on your own server or web hosting space, you need to make sure you have some kind of server side language available such as CGI, PHP, ASP etc. Your hosting company or Web Development team should be able to tell you this.

You can write the code yourself, or search Google to find a ready-written script and instructions. For example, Dimac have a popular add-on called JMail, which would work with ASP. They have a free version available.

I hope this helps.

Regards, Rich.

Edited on Thu 30 Nov 2006, 11:19

RE: Emailing Form Responses

Hi Vanessa

There are a number of methods to do this, but they do depend on the we hosting that you have, as this depends on which code language to use. The way I would do this is to use a script, either javascript or asp or php. The script will strip the data from you web form and send the content to you via email. Below is a code snippet in ASP. Please note that ASP requires a Windows based hosting.

<%


' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim Name
Dim Address
Dim Telephone

' get posted data into variables
EmailFrom = "someone@hotmail.com" 'This is who sends you the email
EmailTo = "someone@hotmil.com" 'This is sends the email to you
Subject = "email"
Name = Trim(Request.Form("Name"))
Address = Trim(Request.Form("Address"))
Telephone = Trim(Request.Form("Telephone"))

' validation
Dim validationOK
validationOK=true
If (Trim(Name)="") Then validationOK=false
If (validationOK=false) Then Response.Redirect("yourerrorpage.htm?" & EmailFrom)

' prepare email body text
Dim Body
Body = Body & "Name: " & Name & VbCrLf
Body = Body & "Address: " & Address & VbCrLf
Body = Body & "Telephone: " & Telephone & VbCrLf

' send email
Dim mail
Set mail = Server.CreateObject("CDONTS.NewMail")
mail.To = EmailTo
mail.From = EmailFrom
mail.Subject = Subject
mail.Body = Body
mail.Send

' redirect to success page
Response.Redirect("yournextpage.htm?" & EmailFrom)
%>


There is some simple validation contained in the script to make sure certain fields are filled in and then if all is ok, the email is sent to you and the website will forward the user to the page you enter. If it fails it will take them to an erro page. You will need to create both the error and success page in dreamweaver using HTML. To creat the email form you will need to select a blank ASP page or the language that you want to use and this will save the page as e.g anemailform.asp. You will need to link to this page so the user can get to the form.

Hope this helps, if you get back to me with the language you are going to use then I can advise you on the exact scripting code that you will need.

David

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Dreamweaver tip:

Testing a site

When developing a site, you have to cater to the widest possible audience allowing for users with different browsers and display settings.
Test pages to see how they look with:

- different display resolutions
- browser with graphics turned off
- many different browsers not just IE
- if possible different operating systems.

View all Dreamweaver hints and tips


Server loaded in 0.05 secs.