BLANK ATTACHMENTS received from online contact form
Dear Forums Users,
I have an online contact form set up on a website where all the fields are required or else the form doesn't get sent as I've used Spry Validation fields in Dreamweaver CS5 on mac. The problem I'm having is when I send a message using this online contact form, I receive the submission in my email inbox as expected, but the message is an attachement and when opened it is BLANK! This is the main problem, that it's showing as blank, the second is that it's appearing in the email as an attachment and not as normal text with the rest of the email.
Please can someone with obviously more experience and wisdom than I please tell me what I'm doing wrong and how I can fix this.
Below is the code I have used for the "mailer.php". (Obviously I have omitted the real email address for obvious reasons here.)
<?PHP
$to = "sample@anemailaddresshere.com";
$subject = "Online Contact Form Message";
$headers = "From: Your Web Site Name here";
$forward = 1;
$location = "thankyou.html";
$date = date ("l, F jS, Y");
$time = date ("h:i A");
$msg = "You have received a message through your Online Contact Form. Please find below the message details. It was submitted on $date at $time.\n\n";
if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo "Thank you for submitting our form. We will get back to you as soon as possible.";
}
?>
Thanking you in advance for your time, advice and help.
