email php html problem!!!!!!!!!!!!?

Andy

New member
I want to check that all fields are filled and then if the email is sent to remain at the same page and the message "your email is sent" to present, if the email is not sent to remain at the same page and the message "your email is not sent" to present. please help me!!!!!!!!!!!!!!!!!!!!!!!

i can use header("Location: $ThanksURL"); only one time if i direct to another page neither of 2 works
here is my script

<?php $to = "[email protected]";
$subject = $_REQUEST['name'] ;
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email";
$ThanksURL = "sent.html";

$sent = mail($to, $subject, $message, $headers) ;

if($sent){
header("Location: $ThanksURL");
} else {
print "Error, try again";
}
?>
 
Back
Top