mail($to,$email_subject,$email_body,$headers); //redirect to the 'thank you' page header('Location: contact-form-thank-you.html'); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Contact form handler</title> </head>
<body> <!-- This page is displayed only if there is some error --> <?php echo nl2br($errors); ?>
Fourth line has a closing bracket but there's no opening bracket......? $email_subject should have $name outside the quotes? $email_body should have various variables outside the qoutes?
if (!preg_match( "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email_address)) { $errors .= "\n Error: Invalid email address"; } // your regex will reject some valid email addresses
if( empty($errors)) { $to = $myemail; $email_subject = "Order form submission for: $name"; $email_body = "You have received a new message. ". " Here are the details:\n Name: $name \n Email: $email_address \n Tel: $tell \n Campaign: $campaign \n Page: $page \n Line:$line \n Quantity: $quantity \n Price: $price"; // $tell is not defined (maybe you meant $tel ?)
$headers = "From: $myemail\n"; // <--- newline in email headers must be \r\n $headers .= "Reply-To: $email_address"; // <--- no newline at all
mail($to,$email_subject,$email_body,$headers);
header('Location: contact-form-thank-you.html'); // not a valid HTTP header ("Location" headers must be a fully-qualified URL) // it's also a good idea to exit after redirecting, // so your script doesn't continue execution } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Contact form handler</title> <!-- no charset defined --> </head>
$email_subject should have $name outside the quotes?
$email_body should have various variables outside the qoutes?
Same with $headers....?
He's using double-quotes. The variables will be parsed and expanded.
-------------------------------------------
@ricky122892 (original post):
Do you really want a full assessment? Or do you have a specific problem that you're asking about?