I have a html page that has a contact form. I don't have captcha on it yet, but I'm trying to learn why this code doesn't work before jumping into that. So, my index.html has this form:
<form id="quote-form" action="inc/sendmail.php" method="post">
<div class="sec-title text-center">
<h1>Request for Quote</h1>
<span class="border center"></span>
</div>
<div class="row">
<div class="col-md-12">
<input type="text" name="name" value="" placeholder="Your Name*" required="">
<input type="email" name="email" value="" placeholder="Your Mail*" required="">
<input type="text" name="phone" value="" placeholder="Your Phone*" required="">
<select class="selectmenu" name=message>
<option selected="selected">Select Service</option>
<option value="Need Quote on a product Alpha</option>
<option>Other</option>
</select>
<button class="thm-btn bg-clr1" type="submit">Get a Quote</button>
</div>
</div>
</form>
My sendmail.php has this code:
<?php
if(isset($_POST['submit'])){
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$phone = $_POST['phone'];
$formcontent="From: $name \n Message: $message \n Email:$email \n Phone:$phone";
$recipient = "testname@gmail.com";
$subject = "Website Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Mail Sent. Thank you, we will contact you shortly.";
}
?>