When a user submits a form, I want one email to come to me with the form fields and a separate email to be sent to the user confirming their submission (two separate emails with different content).
I tried the following form, but only the first email is generated. The second email is never received.
<?php
$url = "http://www.example.com";
$to = 'info@example.com';
$subject = 'Subject';
$headers .= "From: info@example.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message .= "Content of Message 1";
mail($to, $subject, $message, $headers);
$message = "";
$to = $_POST['email'];
$subject = 'Subject';
$headers .= "From: info@example.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message .= "Content of Message 2";
mail($to, $subject, $message, $headers);
$message = "";
echo '<META HTTP-EQUIV=Refresh CONTENT="1; URL='.$url.'">';
?>
What would prevent the second message from sending?