Hi
I have a contact form and I know I have a coding error, but I just can't see the error, some fresh eyes would be appreciated...
HTML Code
Code:
<form method="post" action="contact.php" onsubmit="return checkform(this);MM_validateForm('fname','','R','email','','phone','','RisEmail');return document.MM_returnValue">
<p>
<label for="fname">Your Full Name</label>
<input type="text" id="fname" name="fullname" placeholder="Your full name...">
<label for="email">Your Email Address</label>
<input type="text" id="email" name="email" placeholder="Your Email Address...">
<label for="phone">Your Mobile/Phone Number</label>
<input type="text" id="phone" name="phone" placeholder="Your contact number...">
<label for="address">Your Full Address & Erf Number if available</label>
<input type="text" id="address" name="address" placeholder="Your Full Address...">
<label for="message">Add some extra information</label>
<input type="text" id="message" name="message" placeholder="Add some more...">
<br />
<input type="submit" name="send" value="Submit">
<input type="reset" value="Reset" /></p>
</form>
PHP Code
Code:
<?php
$to = "simon@silvertreeestates.co.za" ;
$from = $_REQUEST['email'] ;
$name = $_REQUEST['fname'] ;
$headers = "From: $from";
$subject = "Silver Tree Website Contact Form";
$fields = array();
$fields{"name"} = "fname";
$fields{"email"} = "email";
$fields{"phone"} = "phone";
$fields{"address"} = "address";
$fields{"message"} = "message";
$body = "'A visitor to the Silver Tree Estates website has provided the following valuation information and would like to be contacted a.s.a.p :\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: office@silvertreeestates.co.za";
$subject2 = "Silver Tree Estates Contact";
$autoreply = "Thank you for contacting Silver Tree Estates for a Free Valuation!
We have received your request for a free valuation and the information you provided, please note we will get back to you as soon as possible
Best Regards,
Diane
Silver Tree Estates
+27 11 675 1190
+27 82 802 0768
office@silvertreeestates.co.za
www.silvertreeestates.co.za";
if($fname == '') {print "You have not entered a name, please go back and try again";}
else {
if($from == '') {print "You have not entered an email, please go back and try again";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( "Location: thanks.html" );}
else
{print "We encountered an error sending your mail, please notify office@silvertreeestates.co.za"; }
}
}
}
?>
Website Link:
http://www.silvertreeestates.co.za/#valuation
The error I seen to get it does not go to the thanks.html page, and I dont get the email
Bookmarks