I am making my record label's official website and just arrived to the contact page of it. I had tried to set it up in a different way, asking help by Google with no positive result! Here you can see my actual using contact form's php part:
<?php
$name=$_REQUEST['name'];
$email = $_REQUEST['email'];
$message = $_REQUEST['message'];
$subject = $_REQUEST['subject'];
$from = 'From: my website name';
$to = 'my@email.com';
$subject = 'New message from the Website!';
$body = "From: $name\n Subject:\n $subject E-Mail: $email\n Message:\n $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>';
}
}
//redirect to the 'thank you' page
header('Location: contact.html');
?>
Here is the HTML form:
<form role="form" action="send.php" method="POST" enctype="multipart/form-data">
<div class="form-group">
<label for="name">name</label>
<input type="name" id="name" placeholder="Your Name *">
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" id="email" placeholder="Your Email *">
</div>
<div class="form-group">
<label for="subject">Subject</label>
<input type="text" placeholder="Subject" id="subject">
</div>
<div class="form-group">
<label for="message">message</label>
<textarea id="message" cols="30" rows="7" placeholder="Message"></textarea>
</div>
<div class="form-group">
<label for="text" >*What is 2+2? (Anti-spam)</label>
<input name="human" placeholder="2 + 2 =">
</div>
<button type="submit" class="btn-default">Send it</button>
</form>
What is my mistake?