can anybody tell me why this little contact form isn't working for me? i get 'Mail Error' when I submit the form.
PHP Code:
<?
$str="";
$str= "Name:".$_POST['txt_name']."<br><br>"."Email: ".$_POST['txt_email']."<br><br>Subject: ".$_POST['txt_subject']."<br><br>Message: <br>".$_POST['txt_msg'];
$to= '[email protected]' ;
$subject="Free Consultation Form";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: '.$email . "\r\n";
$message = $str;
mail($to,$subject,$message,$headers) or die("Mail Error");
if($_POST['chk_me']==1) {
$to= $_POST['txt_email'] ;
$subject="Free Consultation Form";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: '.$email . "\r\n";
$message = $str;
mail($to,$subject,$message,$headers) or die("Mail Error");
}
header("Location:". $_SERVER['HTTP_REFERER']);
?>