# How can i get a form to e-mail the data?



## evoke (Oct 28, 2007)

Hi,

I am hoping someone will be able to help. Im creating a form to go on a business website.

I have downloaded a trial of Dreamweaver and have found it very useful for creating the form. The form looks ok, but i am wondering how can i get the data that has been entered to get emailed to a certain address.

I have been searching around online and tried various instructions but i can't get the php part to work. Since its going to be on a business website, i dont want to use the free form to mail ones. The server that it will be on does support PHP. During searching i read that the data can also be stored in MS Access. Is this tricker to do or is it best to just to stick with the one e-mail task?

If anybody can help, it would be very much appreciated. 

Below i have pasted in the code for the form, just in case.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Untitled Document


Name 

Company 

Postcode 

Phone 

Mobile 

Email 

Preferred Contact Method 

Phone

Mobile

EmailPosition Needed 

Hours Per Week 

Hourly Rate (If Known) 

Work Type 

Full Time

Part Time

Casual

Temporary

OtherJob Description 

Other comments/details 



[/SIZE]


----------



## spacer (Sep 30, 2007)

In the tag , , 
try inserting mailto:[email protected] between the quote marks at action="" .


----------



## haswalt (Nov 22, 2004)

If you put mailto: in there, i know i get this message in ie7 when i clidk submit ( there is nop submit button i the code you posted btw):

"This form is being submitted using e-mail.
Submitting this form will reveal your e-mail address to the recipient, and will send the form withouth encrypting it for privacy.

You may continue or cancel this submission"

I would avoid access at all costs, not a good idea specially for web dev.

I would use the php method as it's easier to format and doens't give you mesasges and warning popups


```
$boundary = uniqid("HTMLFORM");
$headers = "From: [email protected]\r\nMIME-Version: 1.0\r\nContent-Type: multipart/alternative; boundary = ".$boundary."\r\n\r\n";

$headers .= "--$boundary\r\nContent-Type: text/plain; charset=ISO-8859-1\r\nContent-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode("New form information:\r\nName: ".$_POST['name']."\r\n"));

$headers .= "--$boundary\r\nContent-Type: text/html; charset=ISO-8859-1\r\nContent-Transfer-Encoding: base64\r\n\r\n";
$headers .= chunk_split(base64_encode("A new form has been submitted. Here is the result:

[B]Name:[/B] ".$_POST['name']."
"));

$sent = mail("[email protected]", "New Form Submission", "", $headers);

if($sent){
     echo "Thank you form successfully submitted";
}else{
     echo "Sorry, there was an error submitting the form";
}
```
The content of the email is onyla rough guide so you can see how to do the rest of the fields into the email. If you need more help i can give it.

Harry


----------



## tomdkat (May 6, 2006)

I'm with haswalt on this. Use some kind of server-side script to send the e-mail out for you. I recommend FormMail by Tectite.

Peace...


----------



## rickfisher (Nov 4, 2007)

As far as I can remember, PHP scripts created in Dreamweaver won't work in trial mode, meaning you have to upload them to the server in order for them to function properly. Dreamweaver should set it up for you so that a .txt file is sent to you with the information that people type in. Works the same ways as a guestbook.


----------



## MMJ (Oct 15, 2006)

tomdkat said:


> I'm with haswalt on this. Use some kind of server-side script to send the e-mail out for you. I recommend FormMail by Tectite.
> 
> Peace...


Whew!

Almost 10,000 lines just to send an email!


----------



## tomdkat (May 6, 2006)

MMJ said:


> Whew!
> 
> Almost 10,000 lines just to send an email!


Yeah, that is a lot. Gotta keep those damned spammers at bay. 

Peace...


----------

