I am trying to write a PHP mailer script for my website, in the file “contact.php”. I make my form’s action “contact.php”, but when I hit submit it redirects me to a blank page. The email itself also does not send. My PHP is as follows:
[php]
<?php
$firstname = $_POST['first'];
$lastname = $_POST['last'];
$email = $_POST['address'];
$comment = $_POST['question']
$email_from = '
[email protected]'
$email_subject = "A user has a question!"
$email_body = "You have received a new message from $firstname $lastname. \n". "Here is the message:\n $comment".
$to = "
[email protected]";
$headers = "From: $email_from \r\n";
$headers .= "Reply-To: $visitor_email \r\n";
mail($to,$email_subject,$email_body,$headers);
?>
[/php]
And my form is:
Name
E-mail
Questions/Concerns
...etc
I would really love any help as I am still new to PHP. Thanks! :D