please tell me how to fix this.
The HTML form gives the error message when submitting.
I just need this form to grab and send the info the user inputs to my email.
HTML
<form class="form-horizontal" method="post" action="assets/php/contact-form.php">
<fieldset>
<legend class="text-center">Contact Us</legend>
<!-- Name input-->
<div class="form-group">
<div class="col-md-12 col-sm-12">
<input id="name" name="name" type="text" placeholder="Your Name" class="form-control">
</div>
</div>
<!-- Email input-->
<div class="form-group">
<div class="col-md-12 col-sm-12">
<input id="email" name="email" type="text" placeholder="Please enter your email" class="form-control" required="required">
</div>
</div>
<!-- Message body -->
<div class="form-group">
<div class="col-md-12 col-sm-12">
<textarea class="form-control" id="message" name="message" placeholder="How can we help?.." rows="5"></textarea>
</div>
</div>
<!-- Form actions -->
<div class="form-group">
<div class="col-md-12 text-right">
<button id="submit" type="submit" class="btn btn-cyberdime">Submit</button>
</div>
</div>
</fieldset>
</form>
PHP - Here I'm using a fake email for this example to you, so don't worry about that. The issue is something else. I have no idea what it is. When someone tries to submit it just displays the error message echo "Error! Please try again."
<?php
$name=$_POST['name'];
$email=$_POST['email'];
$message=$_POST['message'];
$to = "notmyactualemail@gmail.com";
$subject = "Customer Attention Requested";
$message = " Name: " . $name . "\r\n Email: " . $email . "\r\n Message: " . $message;
$from = "Website Contact Us Form";
$headers = "From:" . $from . "\r\n";
$headers .= "Content-type: text/plain; charset=UTF-8" . "\r\n";
if(@mail($to,$subject,$message,$headers))
{
print "<script>document.location.href='http://mywebsite.com/thank-you.html';</script>";
}else{
echo "Error! Please try again.";
}
?>