I recently built a .php contact form to capture customer information on my website, I built it using dreamweaver cs5 and utilise spry validation for the form. If I fill out the form everything is sent just fine, and if I try and send it without entering the necessary information the spry validation prompts me to make the necessary amendments. However, seemly at random every few weeks I receive a blank email from my form, it looks exactly as it should do except all the result fields are blank. Has anyone got any ideas as to why this could be? Is it loosing the customers information or is something triggering a blank form to be sent? Sorry i’m a total newbie at this kinda thing.
Thanks for taking the time to read this and any help greatly appreciated, here is my code:
<?php
/* Email Variables */
$emailSubject = 'Rental Enquiry';
$webMaster = 'coconutparadisevillas@gmail.com';
/* Data Variables */
$name = $_POST['name'];
$email = $_POST['email'];
$confirmedemail = $_POST['confirmedemail'];
$villa = $_POST['villa'];
$arrival = $_POST['arrival'];
$departure = $_POST['departure'];
$LateCheckout = $_POST['LateCheckout'];
$flexibility = $_POST['flexibility'];
$adults = $_POST['adults'];
$children = $_POST['children'];
$currency = $_POST['currency'];
$source = $_POST['source'];
$phone = $_POST['phone'];
$discountcode = $_POST['discountcode'];
$message = $_POST['message'];
$body = <<<EOD
<br><hr><br>
Name: - - - - - - - - - - - $name <br>
Email: - - - - - - - - - - - $email <br>
Confirmed Email: - - - $confirmedemail <br>
Villa: - - - - - - - - - - - - $villa <br>
Arrival: - - - - - - - - - - $arrival <br>
Departure: - - - - - - - - $departure <br>
Late Checkout: - - - - - $LateCheckout <br>
Flexibility of Dates: - - $flexibility <br>
Adults: - - - - - - - - - - - $adults <br>
Children: - - - - - - - - - - $children <br>
Currency: - - - - - - - - - - $currency <br>
Source: - - - - - - - - - - - -$source <br>
Phone: - - - - - - - - - - - - $phone <br>
Discount Code: - - - - - -$discountcode <br>
Message: - - - - - - - - - - $message <br>
EOD;
$headers = "From: $email
";
$headers .= "Content-type: text/html
";
$success = mail($webMaster, $emailSubject, $body,
$headers);
/* Results rendered as HTML */
$theResults = <<<EOD
<html>
<head>
<title>sent message</title>
<meta http-equiv="refresh" content=
"16;URL=http://www.coconutparadisevillas.com/contact-coconut-paradise-holiday-villas-phuket.html">
<style type="text/css">
<!--
body {
background-color: #000;
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 24px;
font-style: italic;
line-height: normal;
font-weight: normal;
color: #FFF;
text-decoration: none;
padding-top: 200px;
margin-left: 0px;
width: 100%;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
}
-->
</style>
</head>
<div align="center">
<p align="center">Thank you for your enquiry.</p>
<p align="center">We respond to all emails so if you haven't received our reply within 24 hours it may have gone missing</p>
<p align="center">Please be sure to add coconutparadisevillas@gmail.com to you safe list and check your junk email folder regularly</p>
<p align="center"> You will be automatically redirected to "Coconut Paradise Villas" in just a few moments.</p>
</div>
</div>
</body>
</html>
EOD;
echo "$theResults";
?>