0

I have the following html code:

<section>
                                    <form method="post" action="mail.php">
                                        <div class="row gtr-50">
                                            <div class="col-6 col-12-small">
                                                <input type="text" name="name" id="contact-name" placeholder="Name" />
                                            </div>
                                            <div class="col-6 col-12-small">
                                                <input type="text" name="email" id="contact-email" placeholder="Email" />
                                            </div>
                                            <div class="col-12">
                                                <textarea name="message" id="contact-message" placeholder="Message" rows="4"></textarea>
                                            </div>
                                            <div class="col-12">
                                                <label>*What is 2+2? (Make sure you're human!)</label>
                                                    <input name="human" placeholder="Type Here"><br>
                                            </br>
                                                <ul class="actions">
                                                    <li><input type="submit" class="style1" value="Send" /></li>
                                                    <li><input type="reset" class="style2" value="Reset" /></li>
                                                </ul>
                                            </div>
                                        </div>
                                    </form>
                                </section>

Here is my mail.php code:

<?php
if(isset($_POST['submit'])){
    $name=$_POST['name'];
    $email=$_POST['email'];
    $message=$_POST['message'];
    $to='wsizemore00@gmail.com';
    $subject='Hello from Bluegrass Doodles';
    $human=$_POST['human'];
    $from='From: Bluegrass Doodles';
    $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>';
}

?>

You can see this at BluegrassDoodle.com and when you fill out the info it directs you to the mail page but I get nothing in return. I want it to send to my personal email address which is listed in the PHP code. I can click it even without doing the "Make sure you're human" part and it directs it straight to the mail.php page. Any help is appreciated. I'm very basic in html/css and no experience in php.

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141

0 Answers0