FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Making a mail-to form in dreamweaver (read more)

 


tom69
I would like to make a form like this one: http://tip.it/runescape/?contact

I want my form to look like that without the ''category'' option. So that, when a user wants to e-mail me he ust has to fill in ''subject'' ''username'' ''e-mail'' etc. and his text and when he clicks submit it gets sent to the e-mailadres: no_lifers@hotmail.com

all this has to happen without microsoft outlook opening, so just fill it in and i receive an e-mail.

I have been google-ing for 3 days now and still didn't find what i realy need, somethings seem to be IT but they are just too hard to understand.

Please help, good information + easy to understand =p

thanks. I got some frih's left.
LukeakaDanish
Here's the code i use for that kind of simple contact form. The first part is the form, and the second part is the processing and email sending bit. Its not from dreamweaver (real pro's write their own code), but I'm pretty certain that its easy to incorporate...

Code:

<form action="contact_post.php" method="post">
<table style="border: 0px;">
   <tr>
      <td>Type</td>
      <td>
<select name="type">
   <option value="Pre Sales Query">Pre Sales Query</option>
   <option value="Webdesign Question">Webdesign Question</option>
   <option value="Hosting Question">Hosting Question</option>
   <option value="General Question">General Question</option>
   <option value="Other">Other</option>
</select>
      </td>
   </tr>
   <tr>
      <td>Subject</td>
      <td><input type="text" name="subject" /></td>
   </tr>
   <tr>
      <td>Your e-mail</td>
      <td><input type="text" name="sender_email" /></td>
   </tr>
   <tr>
      <td>Name</td>
      <td><input type="text" name="name" /></td>
   </tr>
   <tr>
      <td>Message</td>
      <td><textarea style="width: 300px; height: 200px;" name="message"></textarea></td>
   </tr>
   <tr>
      <td>Date & Time<br />(in UK)</td>
      <td><input type="text" value="<?php echo date("d.m.Y - H:i"); ?>" disabled="true" /><input type="hidden" value="<?php echo date("d.m.Y - H:i"); ?>" name="send_date" /></td>
   </tr>
   <tr>
      <td></td>
      <td><input type="submit" value="Send" /><input type="reset" value="Reset" /></td>
   </tr>
</table>
</form>


second part (saved as contact_post.php):

Code:

<?php

if (isset($_POST['subject']) && isset($_POST['name']) && isset($_POST['message']) && isset($_POST['send_date']) && isset($_POST['sender_email'])) {
   $type = htmlspecialchars($_POST['type']);
   $subject = htmlspecialchars($_POST['subject']);
   $sender_email = htmlspecialchars($_POST['sender_email']);
   $name = htmlspecialchars($_POST['name']);
   $msg = htmlspecialchars($_POST['message']);
   $send_date = htmlspecialchars($_POST['send_date']);
   
   $mail['to'] = 'me@to.kg';
   $mail['subject'] = "$type - $subject";
   $mail['message'] = "On $send_date $name posted the following question: \n $msg";
   $mail['headers'] = "From: PlatinumDesign Question Form: $sender_email";

   if (mail($mail['to'], $mail['subject'], $mail['message'], $additional_header =  $mail['headers'])) {
   }
   else {
   echo('Error: The mail function failed - please press back and try again');
   exit;
   }
}
else {
   echo('Error: Incomplete submission - please press back and try again');
   exit;
}

?>

<!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" xml:lang="en" lang="en">

<head>
...


The actual app. is here:

www.platinumdesign.co.uk/contact.php

If you use it, please credit my company, platinumdesign, somewhere on your page (i.e. not as a comment in your code)

Hope this helps..
tom69
i'll sure credit it;) i'll send u my site later so u can check but uihm how does it know where to send to email to?
tom69
don't i have to give it an action etc. like action :mail_to and GET somethings i remember, be sure to add me on msn Wink ... check private messages
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.