0
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 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 changed the email here, but the email I am using is a valid email. When I click submit, I get the message that the message was successfully sent, but the reality is that I am not receiving anything in my email. Any suggestions? Thank you
Basic question: have you checked your email spam box? And there is no field in the form called
human
, what would that be?– Woss
was the first thing I did!
– Diana Madeira
does so, comments //$Human = $_POST['Human']; and puts below it $Human = 4; and see if you receive email in your box
– user60252
Voce suggests that I eliminate $Human = $_POST['Human']; and replace it with $Human = 4?
– Diana Madeira
no, he comments it with two bars /$Human = $_POST['Human']; and puts below it $Human = 4;
– user60252
I will have to give a way out, but I left an answer. Don’t forget to uncomment $Human = $_POST['Human'] and elimibar $Human = 4;
– user60252
I made an edit in the reply explaining what was happening in your code
– user60252