I think this is straightforward, but for some reason it's not working. Does anyone see a problem with my code? If not, I'm guessing it's the hosting that's the issue.
Here's the code:
HTML
<form action="sendmail.php" name="form1" method="post">
<input name="hidSubmit" type="hidden" value="true" id="hidSubmit" />
<input type="text" placeholder="Your Name" name="txtName" required><br>
<input type="email" placeholder="Email Address" name="txtEmail" required><br>
<input type="number" placeholder="Phone Number" name="txtPhone"><br>
<button type="submit" value="Submit" class="butt"><strong>Submit</strong></button>
</form>
PHP
<?php
//Check whether the submission is made
if(isset($_POST["hidSubmit"])){
//msg body
$txtMsg = "Enquiry From Website
Name : ".$_POST["txtName"]."
Email: ".$_POST["txtEmail"]."
Phone: ".$_POST["txtPhone"]."
";
//Declarate the necessary variables
$mail_to = "info@insidemarketstrategy.com";
$mail_from= "admin@insidemarketstrategy.com";
$mail_sub="Inquiry from insidemarketstrategy.com Website";
$mail_mesg=$txtMsg;
$headers = "From: admin@insidemarketstrategy.com
" .
"X-Mailer: php" . "Content-type: text/html; charset=iso-8859-1
";
//Check for success/failure of delivery
if(mail($mail_to,$mail_sub,$mail_mesg,$headers))
echo "<div class='alert alert-success alert-dismissable' id='alertmsg'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<h3>Thank you !<br><br><span>we will get in touch with you soon</span></h3>
</div>";
else
echo "<div class='alert alert-danger alert-dismissable'><center><span class='textred' align='center'><b>Failed to send the E-mail from $mail_sub to $mail_to</b></span></center></div>";
}
echo ("<meta http-equiv='refresh' content='5 ;url=index.html'>");
?>