Okay, so I have a contact form:
<?php
$body = "From: $name
E-Mail: $email
Message:
$message";
if ($_POST['submit']) {
if ($name != '' && $email != '') {
if ($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>';
}
} else {
echo '<p>You need to fill in all required fields!</p>';
}
}
?>
And the HTML code to go with it:
<form action="" method="POST">
<!--PHP Code above goes here-->
<div>
<label>Name</label>
<br>
<input name="name" placeholder="Type Here">
</div>
<div>
<label>Email</label>
<br>
<input name="email" type="email" placeholder="Type Here">
</div>
<div>
<label>Message</label>
<br>
<textarea name="message" placeholder="Type Here"></textarea>
</div>
<div>
<label>*What is 2+2? (Spam protection)</label>
<br>
<input name="human" placeholder="Type Here">
</div>
<input id="submit" name="submit" type="submit" value="Submit">
</form>
But even when all of the fields are filled in, it keeps telling me to fill in all the required fields. Thanks in advance.