I have never used PHP before so apologies if this is totally ridiculous. I am struggling to get my contact form to work. Here is my HTML:
<form method="post" action="contact-form.php">
<div class="input-third">
<label for="name">Name: <small>*</small></label>
<br>
<input class="input" type="text" name="name" placeholder="John Smith" />
</div>
<div class="input-third">
<label for="email">Email: <small>*</small></label>
<br>
<input class="input" type="text" name="email" placeholder="mail@example.com" />
</div>
<div class="input-third">
<label for="phone">Phone:</label>
<br>
<input class="input" type="text" name="phone" placeholder="Type Here" />
</div>
<br>
<br>
<label for="message">Message: <small>*</small></label> <br>
<textarea class="message" name="message" placeholder="Write a message to us"></textarea>
<br>
<label>*What is 2+2? (Anti-spam)</label>
<input name="human" placeholder="Type Here">
<input class="submit" type="submit" value="Send" name="submit">
</form>
And Here is the PHP:
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$message = $_POST['message'];
$from = 'From: IPS Facilities Contact Form';
$to = 'noah.searle@gmail.com';
$subject = 'Enquiry';
$human = $_POST['human'];
$body = "From: $name\n E-Mail: $email\n Message: $message\n";
if ($_POST['submit'] && $human == '4') {
if (mail ($to, $subject, $body, $from)) {
echo '<p>Your message has been sent!</p>';
} else {
echo '<p>Something went wrong, go back and try again!</p>';
}
} else if ($_POST['submit'] && $human != '4') {
echo '<p>You answered the anti-spam question incorrectly!</p>';
}
?>
When I hit submit, it displays the message has been sent but I have not received anything! I'm sure it is something silly but I would appreciate some input!