This is my first post so sorry if i stuff up the code block. I have been reading through the forum trying to figure out what is wrong but can't find an answer. I am hoping someone here can help. As the title suggests, when I click submit on my form I am getting to the "thank you for contacting us" message but the form isn't sending an email. I cannot for the life of me figure out why. Could someone please review my code and let me know if you find any errors. Would really appreciate your time.
<?php
//if "email" variable is filled out, send email
if (isset($_REQUEST['email'])) {
//Email information
$admin_email = "tomcross@live.com";
$email = $_REQUEST['email'];
$subject = $_REQUEST['subject'];
$comment = $_REQUEST['comment'];
//send email
mail($admin_email, "$subject", $comment, "From:" . $email);
//Email response
echo "Thank you for contacting us!";
}
//if "email" variable is not filled out, display the form
else {
?>
<form id="contact-form" class="contact" name="contact-form" method="post" action="send-mail.php">
<div class="form-group">
<input type="text" name="name" class="form-control name-field" required placeholder="Your Name">
</div>
<div class="form-group">
<input type="email" name="email" class="form-control mail-field" required placeholder="Your Email">
</div>
<div class="form-group">
<textarea name="message" id="message" required class="form-control" rows="8" placeholder="Message"></textarea>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">Send</button>
</div>
</form>
<?php
}
?>