Can someone please tell me how to fix this script so the form info is sent to the correct email (i.e., my email....lets assume my email is [email protected]). I would like the email to show the user's email addrress who sent to to me as well.
<?php
$name = $_POST['fldName'];
$email = $_POST['fldEmail'];
$phone = $_POST['fldPhone'];
$comments = $_POST['fldComments'];
$isFormValid = false;
if (strlen($name) && strlen($email) && strlen($phone) && strlen($comments)) $isFormValid = true;
if ($isFormValid)
{
$to = '[email protected]';
$subject = 'Contact Us Form Comments';
$message = 'Name: '.$name."\r\n".'Email: '.$email."\r\n".'Comments: '.$comments;
$headers = 'From: [email protected]' . "\r\n"
. 'Reply-To: [email protected]' . "\r\n";
mail($to, $subject, $message, $headers);
header("location: thankyou.html");
}
else
{
echo "Please fill in the required fields";
}
?>