you are missing the redirect. also, you probably only want the mail function to execute if post data was sent. here is an example that i haven't tested yet.
PHP Code:
<?php
/************************************************** *\
* PHP 4.1.0+ version of email script.
\************************************************* **/
//
//
if($_POST){
$sendTo = "user@AOL.com";
$subject = "Your request from Design";
//
//
$headers = "From: " . $_POST["companyname"];
$headers .= "<" . $_POST["email"] .">\r\n";
// next include a Reply-To:
$headers .= "Reply-To: " . $_POST["email"];
//
//
$message = $_POST["companyname"] ."\r\n";
$message .= $_POST["address"] ."\r\n";
$message .= $_POST["phone"] ."\r\n";
$message .= $_POST["email"] ."\r\n\n";
$message .= $_POST["message"];
//
//
mail($sendTo, $subject, $message, $headers);
header("location: thanks.html");
exit;
}
?>
Here's the form code snippet:
<form action="phpmail.php" method="post" enctype="multipart/form-data" name="form1">
<p>
<input name="companyname" type="text" id="companyname4">
Company Name*</p>
<p>
<input name="address" type="text" id="address4">
Address
<input type=hidden name="redirect" value="thanks.html">
</p>
<p>
<input name="phone" type="text" id="phone4">
Phone</p>
<p>
<input name="email" type="text" id="email4">
Email*</p>
<p>
<textarea name="message" id="textarea3"></textarea>
Questions</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
<p>
<input type="reset" name="Submit2" value="Reset">
</p>
</form>