1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

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

Discussion in 'Web Design & Development' started by evoke, Oct 28, 2007.

Thread Status:
Not open for further replies.
Advertisement
  1. evoke

    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]
     
  2. spacer

    spacer

    Joined:
    Sep 30, 2007
    Messages:
    30
    In the <form> tag , <form id="form1" name="form1" method="post" action=""> ,
    try inserting mailto:[email protected] between the quote marks at action="" .
     
  3. haswalt

    haswalt

    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
     
  4. tomdkat

    tomdkat Retired Trusted Advisor

    Joined:
    May 6, 2006
    Messages:
    7,148
    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...
     
  5. rickfisher

    rickfisher

    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.
     
  6. MMJ

    MMJ Guest

    Joined:
    Oct 15, 2006
    Messages:
    3,625
    Whew!

    Almost 10,000 lines just to send an email!
     
  7. tomdkat

    tomdkat Retired Trusted Advisor

    Joined:
    May 6, 2006
    Messages:
    7,148
    Yeah, that is a lot. Gotta keep those damned spammers at bay. :p

    Peace...
     
  8. Sponsor

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 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/644661

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice