I have set up a PHP mail form on a couple sites and it has worked perfectly, but I am now trying to do it again on another site and am getting this error (even though it's the same code):
Notice: Undefined variable: message in E:\WWW Root\7springs.com\inquiry.php on line 11
Here is my PHP script:
<?php
$mailto = "taylor@carneyfireman.com";
$subject = "Conference Inquiry";
$redirect = "thankyoupage.shtml";
$header = "From: Conference site Visitor";
foreach($_POST as $key => $value) {
$message .= $key . ': ' . $value;
$message .= "\n";
}
if (@mail($mailto, $subject, $message, $header)) {
header("Location: $redirect");
} else {
echo('<p>Mail could not be sent. Please use your back button to try again.</p>');
}
?>
Can someone please tell me what the problem is?