hi guys
thanks very much for all the advice. i've added the isset although that didn't help my problem. i'm not sure if i explained it very well. upon succesful form submit i want the surfer to be redirecte3d to the thanks.htm page. however currently rather than redirect the thanks.html page weirdly lays on top of the contact htm page so that you can see both in the same window.
this is the code i'm using
PHP Code:
error_reporting(E_ALL); ini_set('display_errors', 'On');
ini_set("sendmail_from", "[email protected]");
$email_to = "[email protected]";
$from = $_REQUEST['email'];
$headers = "From: $from";
$email_subject = "Web Contact Data";
$name = $_POST['name'];
$email = $_POST["email"];
$email_message = $_POST["message"];
$from = $_POST["email"];
$phone = $_POST["phone"];
$company = $_POST["company"];
$email_message = "We have received the following message:\n\nName: " . $name . "\r\nEmail: " . $email . "\r\nPhone: " . $phone . "\r\nCompany: " . $company . "\r\nMessage: " . $email_message;
if($from == '') {print "You have not entered an email, please go back and try again";}
else {
if($name == '') {print "You have not entered a name, please go back and try again";}
else {
$send = mail($email_to, $email_subject, $headers, $email_message, "[email protected]");
if(isset($send))
{header("Location: http://www.mydomain.com/thanks.html");
exit();
}
else
{echo "We encountered an error sending your mail, please notify [email protected]";}
exit();
}
}
one other problem that i can't see where its wrong is that it i get the error "Notice: Undefined variable: phone in /home/admin/domains/mydomain.com/public_html/contact.php on line 19 however as far as i can see i've defined what phone is?
can anyone see what's wrong with my code?
thanks in advance