i've made a website with a contact form, but everytime you click the send button it opens the computer default e-mail client. i know there is a way of doing this, but i dont know how.

I think it involves php and if it does can somebody show me how to do it, in simple terms (because i'm new to php),

<form action="mailto:mail@address.com" method="post" name="contact" id="contact">
<table width="648" border="0" align="center">
    <tr>
      <td width="329" align="right"><div align="right">Title:</div></td>
      <td width="10" align="right">&nbsp;</td>
      <td width="300"><div align="left">
        <select name="title" id="title">
          <option>-- Select One --</option>
          <option>Mr</option>
          <option>Mrs</option>
          <option>Miss</option>
          <option>Ms</option>
        </select>
      </div></td>
    </tr>
    <tr>
      <td align="right"><div align="right">First Name:</div></td>
      <td align="right">&nbsp;</td>
      <td><div align="left">
        <input type="text" name="firstName" id="firstName">
      </div></td>
    </tr>
    <tr>
      <td align="right"><div align="right">Last Name:</div></td>
      <td align="right">&nbsp;</td>
      <td align="left"><div align="left">
        <input type="text" name="lastName" id="lastName">
      </div></td>
    </tr>
    <tr>
      <td align="right">&nbsp;</td>
      <td align="right">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td align="right"><div align="right">Telephone:</div></td>
      <td align="right">&nbsp;</td>
      <td><div align="left">
        <input name="phone" type="text" id="phone" size="51">
      </div></td>
    </tr>
    <tr>
      <td align="right"><p align="right">E-Mail:</p></td>
      <td align="right">&nbsp;</td>
      <td><div align="left">
        <input name="e-mail" type="text" id="e-mail" size="51">
      </div></td>
    </tr>
    <tr>
      <td align="right"><div align="right"></div></td>
      <td align="right">&nbsp;</td>
      <td><div align="left"></div></td>
    </tr>
    <tr>
      <td align="right"><div align="right">Reason for Contacting:</div></td>
      <td align="right">&nbsp;</td>
      <td><div align="left">
        <select name="reason" id="reason">
          <option>-- Select One --</option>
          <option>General Enquiry</option>
          <option>Tips</option>
          <option>Commisioning</option>
          <option>Website Fault</option>
        </select>
        </div></td>
    </tr>
    <tr>
      <td align="right"><div align="right"></div></td>
      <td align="right">&nbsp;</td>
      <td><div align="left"></div></td>
    </tr>
    <tr>
      <td align="right" valign="top"><div align="right">Enquiry:</div></td>
      <td align="right">&nbsp;</td>
      <td><div align="left">
        <textarea name="enquiry" cols="48" rows="5" wrap="physical" id="enquiry"></textarea>
      </div></td>
    </tr>
    <tr>
      <td align="right" valign="top"><div align="right">
        <input type="submit" name="send" id="send" value="Send" a href="Contact.html" onClick="alert("You will now be redirected to your e-mail client")">
      </div></td>
      <td align="right">&nbsp;</td>
      <td><div align="left">
        <input type="reset" name="clear" id="clear" value="Clear">
      </div></td>
    </tr>
  </table>
  <label></label>
  <p>
    <label></label>
  </p>
</form>

Need help ASAP please

Recommended Answers

All 7 Replies

where do you want to send your information?

Right now you are using a mailto tag as the action for your form. If you want to use php, you need to have a php file as the action and use that php file to handle the information.

ok, it doesn't have to be php, all it has to do is send it to a specified e-mail address without opening the users default e-mail client and then needing them to press send.

If the only way is php, then so be it

php is easiest using the mail() function. You can format the email message however you like.

You can do it pretty easily in PHP with the mail() function. To do this though you would need to change the action attribute on your form tag to your PHP script. Then construct the message in PHP and use the mail() function to send it. For more on mail() see W3Schools and the PHP.net Reference.

You'd need to change your line to

<form action="filename.php" method="post" name="contact" id="contact">

the php code is in a separate file, a text file is what i use.

If you happen to host the site on godaddy, then have a basic php form already written and ready to use.

Otherwise you can start here
http://www.w3schools.com/php/php_forms.asp

action="none"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.