- This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Can anyone tell me what is wrong with my coding?
$errors = '';
$myemail = '[email protected]';
}
$campaign = $_POST;
$page = $_POST;
$line = $_POST;
$quantity = $_POST;
$price = $_POST;
$email_address = $_POST;
$tel = $_POST;
$name = $POST;
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";
}
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";
$headers = "From: $myemailn";
$headers .= "Reply-To: $email_address";
mail($to,$email_subject,$email_body,$headers);
//redirect to the 'thank you' page
header('Location: contact-form-thank-you.html');
}
?>
Contact form handler
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?
Same with $headers….?
Doh, of course. I’m so used to single quotes now. :-/