I followed the kirupa tutorial on building a contact form and using the mailer.php last night. The problem is that it only sends the information collected 3 out of 6 times.
Is there any reason this is happening? I’m not getting any errors…
<?php
if(isset($_POST[‘submit’])) {
$to = "jagreen78@gmail.com";
$subject = "A message from the web site form";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$company_field = $_POST['address'];
$city_field = $_POST['city'];
$state_field = $_POST['state'];
$zip_field = $_POST['zip'];
$message = $_POST['message'];
//$option = $_POST['radio'];
//$dropdown = $_POST['drop_down'];
foreach($_POST['check'] as $value) {
$check_msg .= "$value
";
}
$body = "From: $name_field
E-Mail: $email_field
Company Address: $company_field
City: $city_field
State: $state_field
Zip: $zip_field
They are contacting us for the following reason: $check_msg
Message:
$message
";
//echo "Thanks for your email.";
mail($to, $subject, $body);
} else {
echo “You did not complete the form!”;
}
?>