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

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

evoke

Thread Starter
Joined
Oct 28, 2007
Messages
1
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">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style7 {font-family: Arial, Helvetica, sans-serif; font-size: 10px; }
.style9 {font-family: Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold; }
-->
</style>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
<table width="928" border="0">
<tr>
<td width="154"><div align="right"><span class="style9">Name</span></div></td>
<td width="28">&nbsp;</td>
<td width="732"><span class="style7">
<label>
<input name="name" type="text" id="name" size="57" />
</label>
</span></td>
</tr>
<tr>
<td><div align="right"><span class="style9">Company</span></div></td>
<td>&nbsp;</td>
<td><span class="style7">
<label>
<input name="company" type="text" id="company" size="57" />
</label>
</span></td>
</tr>
<tr>
<td><div align="right"><span class="style9">Postcode</span></div></td>
<td>&nbsp;</td>
<td><span class="style7">
<label>
<input name="postcode" type="text" id="postcode" size="57" />
</label>
</span></td>
</tr>
<tr>
<td><div align="right"><span class="style9">Phone</span></div></td>
<td>&nbsp;</td>
<td><span class="style7">
<label>
<input name="telephone" type="text" id="telephone" size="57" />
</label>
</span></td>
</tr>
<tr>
<td><div align="right"><span class="style9">Mobile</span></div></td>
<td>&nbsp;</td>
<td><span class="style7">
<label>
<input name="mobile" type="text" id="mobile" size="57" />
</label>
</span></td>
</tr>
<tr>
<td><div align="right"><span class="style9">Email</span></div></td>
<td>&nbsp;</td>
<td><span class="style7">
<label>
<input name="email" type="text" id="email" size="57" />
</label>
</span></td>
</tr>
<tr>
<td><div align="right"><span class="style9">Preferred Contact Method</span></div></td>
<td>&nbsp;</td>
<td><span class="style7">
<label>
<input type="radio" name="radio" id="Phone" value="Phone" />
</label>
Phone
<label>
<input type="radio" name="radio" id="Mobile" value="Mobile" />
</label>
Mobile
<label>
<input type="radio" name="radio" id="email2" value="email" />
</label>
Email</span></td>
</tr>
<tr>
<td><div align="right"><span class="style9">Position Needed</span></div></td>
<td>&nbsp;</td>
<td><span class="style7">
<label>
<input name="Position" type="text" id="Position" size="57" />
</label>
</span></td>
</tr>
<tr>
<td><div align="right"><span class="style9">Hours Per Week</span></div></td>
<td>&nbsp;</td>
<td><span class="style7">
<label>
<input name="Hours" type="text" id="Hours" size="57" />
</label>
</span></td>
</tr>
<tr>
<td><div align="right"><span class="style9">Hourly Rate (If Known)</span></div></td>
<td>&nbsp;</td>
<td><span class="style7">
<label>
<input name="hourlyrate" type="text" id="hourlyrate" size="57" />
</label>
</span></td>
</tr>
<tr>
<td><div align="right"><span class="style9">Work Type</span></div></td>
<td>&nbsp;</td>
<td><span class="style7">
<label>
<input type="radio" name="radio" id="fulltime" value="fulltime" />
</label>
Full Time
<label>
<input type="radio" name="radio" id="parttime" value="parttime" />
</label>
Part Time
<label>
<input type="radio" name="radio" id="casual" value="casual" />
</label>
Casual
<label>
<input type="radio" name="radio" id="temp" value="temp" />
</label>
Temporary
<label>
<input type="radio" name="radio" id="other" value="other" />
</label>
Other</span></td>
</tr>
<tr>
<td><div align="right"><span class="style9">Job Description</span></div></td>
<td>&nbsp;</td>
<td><span class="style7">
<label>
<textarea name="jobdescription" id="jobdescription" cols="45" rows="5"></textarea>
</label>
</span></td>
</tr>
<tr>
<td><div align="right"><span class="style9">Other comments/details</span></div></td>
<td>&nbsp;</td>
<td><span class="style7">
<label>
<textarea name="comments" id="comments" cols="45" rows="5"></textarea>
</label>
</span></td>
</tr>
</table>
</form>
</body>
</html>
[/SIZE]
 
Joined
Nov 22, 2004
Messages
414
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

PHP:
$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: <br /><br /><b>Name:</b> ".$_POST['name']."<br />"));

$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
 
Joined
Nov 4, 2007
Messages
59
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.
 

tomdkat

Retired Trusted Advisor
Joined
May 6, 2006
Messages
7,148
MMJ said:
Whew!

Almost 10,000 lines just to send an email!
Yeah, that is a lot. Gotta keep those damned spammers at bay. :p

Peace...
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top