Form to E-Mail Problem


I’m in the process of creating a form for the first time.

All appears to be work until I click submit then instead of sending the e-mail it diects you to php script.

I wonder if you coding geniuses could shed any light on this.

my php code look as follows:


$emailSubject = 'contactform';
$webMaster = '';

$email = $_POST['email'];
$name = $_POST['name'];
$comments = $_POST['comments'];

$body = <<<EOD
Name: $name <br>
Email: $email <br>
Comments: $comments <br>
$headers = "From: $email\\r\
$headers .= "Content-type: text/html\\r\
$success = mail($webMaster, $emailSubject, $body,

/* Results rendered as HTML */
$theResults = <<<EOD
<title>sent message</title>
<meta http-equiv="refresh" content="5;URL=">
<style type="text/css">
body {
font-family: Tahoma, Geneva, sans-serif;
font-size: 20px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #000;;
text-decoration: none;
padding-top: 200px;
margin-left: 150px;
width: 800px;
<div align="center">Your message has been sent! We are now dealing with your request will get back to you asap</div>
echo "$theResults";

you had better post the code for your form, I cannot tell from the above that there is a redirect going on …

Make sure the ACTION= value in your form matches the name of this file, and that they are in the same directory (for now).

I would TRUELY APPRECIATE any help/advice you can give me on this!

the code to my form is as follows:

<th rowspan=“4” scope=“col”><div class=“contactform”><form id=“contactform” name=“contactform” method=“post” action=“contactform.php”>
<label for=“name”>Name: <br/>
<input type=“text” name=“name” id=“name” />

        &lt;label for="name"&gt;Email: &lt;br/&gt;
          &lt;input type="text" name="email" id="email" /&gt;
        &lt;label for="name"&gt;Subject: &lt;br/&gt;
        	&lt;input type="text" name="subject" id="subject" /&gt;
        	&lt;br /&gt;
        &lt;label for="Comments"&gt;Comments:&lt;/label&gt;&lt;br/&gt;
        &lt;textarea name="Comments" cols="45" rows="5" id="Comments"&gt;&lt;/textarea&gt;&lt;br/&gt;&lt;br/&gt;
        &lt;input name="Submit" type="submit" id="Submit" onclick="MM_validateForm('name','','R','email','','RisEmail','Comments','','R');MM_validateForm('name','','R','email','','RisEmail','Comments','','R');return document.MM_returnValue" value="Submit" /&gt;


God knows what is going on inside this lot “MM_validateForm”, I cannot help you there.

Format your code with

 [ /php] tags (less the space I left in before / ).

To test if dw is friggin you around, disable js and press the submit button, as long as your script contactform.php contains what you want (ie send emails) then it should hook up.

If that works with js off, then you know its a js problem.