I am trying to figure out what is wrong with my coding. I have my contact form on my site and I am trying to make it work correctly. When I hit submit, it just goes to a blank page. My contact form that is through my HTML is action=mailer.php and my php script is saved as mailer.php. Not sure what I am doing wrong with it all. If anyone can help me and guide me through it, that would be great. I am new to php and I am trying to learn it.
<?php $sendMessage = false; if (isset ($_REQUEST['message']) && isset($_REQUEST['email']) && isset($_REQUEST['name'])) { $email = $_REQUEST['email']; $name = $_REQUEST['name']; $subject = $_REQUEST['subject']; $message = $_REQUEST['message']; if (strlen($message) > 0 && strlen($email) > 0 && strlen($subject) > 0 && strlen($name) > 0) { $sendMessage = true;} } if (isset ($_REQUEST['posted']) && (!$sendMessage)) { echo "Please fill in all the values";} if ($sendMessage) { //[email protected] $to= "[email protected]"; $subject= "Website Feedback."; $headers= "Mime Version: 1.0". "\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n"; $headers .= "From: $email\r\n"; // setup the from field for e-mail $headers .= "Content-type: text/html\r\n"; // setup e-mail format $success = mail($to, $subject, $message, $headers); if ($success) // if successful display the message & success message { echo "You sent the following:$message
"; echo "
Form submitted successfully.
"; } else // If not successful let the user know { echo "An error occurred when trying to send the e-mail."; } } ?>