I created a contact form in HTML:
<form id="contactform" method="post" action="contact_form.php">
<h3> Get in touch</h3>
<h4> Fill in the form below, and we'll get back to you as soon as possible</h4>
<label>Name</label>
<input name="name" placeholder="Type here" required>
<label>Email</label>
<input name="email" placeholder="Please enter your email address" required>
<label>Message:</label>
<textarea name="message" placeholder="Type here" required></textarea>
<input id="submit" name="submit" type="submit" value="submit">
</form>
And then I did post to a PHP page:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = 'From: galaxybooks';
$to = '[email protected]';
$subject = 'contact';
$human = $_POST['human'];
$body = "From: $name\n E-Mail: $email\n Message:\n $message";
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>';
}
?>
For privacy reasons, I've changed the email here, but the email I'm using is a valid email. when I click submit, I receive the message that the message was sent successfully, but the reality is that I am not receiving anything in my email. Any suggestion? Thanks