Form to E-Mail Problem

Hi,

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:

<?php


$emailSubject = 'contactform';
$webMaster = 'info@dinkcreative.co.uk';

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



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

/* Results rendered as HTML */
$theResults = <<<EOD
<html>
<head>
<title>sent message</title>
<meta http-equiv="refresh" content="5;URL=http://www.dinkcreative.co.uk/contact.htm">
<style type="text/css">
<!--
body {
background-color:
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;
}
-->
</style>
</head>
<div align="center">Your message has been sent! We are now dealing with your request will get back to you asap</div>
</div>
</body>
</html>
EOD;
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>
<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” />
</label><br/><br/>

        &lt;label for="name"&gt;Email: &lt;br/&gt;
          &lt;input type="text" name="email" id="email" /&gt;
        &lt;/label&gt;&lt;br/&gt;&lt;br/&gt;
        
        &lt;label for="name"&gt;Subject: &lt;br/&gt;
        	&lt;input type="text" name="subject" id="subject" /&gt;
        	&lt;br /&gt;
        &lt;/label&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;label&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;
        &lt;label&gt;&lt;

</form></div></th>

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.