I just can't seem to figure out why this form is not submitting. It is a simple contact form that I am trying to build.
html:
<div class="contact-container" id="contact">
<div class="contact-wrapper">
<form method="post" action="form.php">
<h2>Contact Us</h2>
<input type="name" placeholder="Name and Surname" required />
<input type="email" placeholder="Email" required />
<textarea type="message" placeholder="Message" required></textarea>
<input class="submit" type="submit" placeholder="submit" />
</form>
</div>
</div>
php:
if(isset($_POST['email']) && $_POST['email'] != '') {
if( filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) ) {
$name = $_POST['name'];
$visitor_email = $_POST['email'];
$message = $_POST['message'];
$email_subject = "New Form Submission";
$email_body = "User Name: $name.\n".
"User Email: $visitor_email.\n\n".
"User Message: $message\n";
$to = "info@goldberylmedia.com";
$headers = "From: $email_from \r\n";
$headers = "Reply-To: $visitor_email \r\n";
mail($to, $email_subject, $email_body, $headers);
header ("Location: ../index.html");
echo '<script> alert("Message received. We will get back to you soon.") </script>';
}
}
And I am also trying to make an alert that the message has been sent, but that hasn't been working either.
Thanks for the help in advance for the help.