I currently have my site www.vivascoaching.com up and I cannot seem to get the contact form portion of the page to email me back when that form I have there is filled out. Currently I have an index.html file and a separate php file called callback.php I am new to php so I am not sure if this is the correct way to do it.
This is the index.html file:
<!DOCTYPE HTML>
<html>
<head>
<title>Vivas Coaching-Main</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../style/main.css">
<link rel="stylesheet" href="../style/normalize.css">
</head>
<body>
<header>
<img src="Images/logo.png" alt="logo" width="465px" height="135px" align="middle">
</header>
<div class="left_column">
<nav id="secondarylinks">
<ul>
<li><a href="register.html" title="Register">Register</a></li>
<li><a href="dates.html" title="Dates">Dates</a></li>
<li><a href="pricing.html" title="Pricing">Pricing</a></li>
<li><a href="forms.html" title="Forms">Forms</a></li>
</ul>
</nav>
</div>
<div class="middle_column">
<nav id="mainlinks">
<ul>
<li><a href="index.html" title="Main">Main</a></li>
<li><a href="classes.html" title="Classes">Classes</a></li>
<li><a href="teambuilding.html" title="Team Building">Team Building</a></li>
</ul>
</nav>
<img src="Images/SAT summer flyer.jpg" alt="SAT summer flyer" width="800px" height="800px">
<footer>
<p>©VivasCoaching 2016</p>
</footer>
</div>
<div class="right_column">
<h2>Contact Us</h2>
<p>(646)316-8481/<br>(403)718-0159</p>
<p>Please fill out the information below and we will get back to you as soon as possible!<p>
<form method="post" action="callback.php">
<label for="firstname">First Name: </label>
<input type="text" name="firstname"/>
<label for="lastname">Last Name: </label>
<input type="text" name="lastname"/>
<label for="email">Email: <span class="required"></label>
<input type="text" name="email"/>
<label>*What is 2+2? (Anti-spam)</label>
<input name="human" placeholder="Type Here">
<label for="message"> Message: <span class="required"></label>
<textarea id="message" name="message" cols="25" rows="10" placeholder="Type your message here!"></textarea>
<input type="submit" id="submit"/>
</form>
</div>
</body>
</html>
And this is the callback.php:
<?php
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$message = $_POST['message'];
$to = 'vivascoaching@gmail.com';
$subject = 'inquiry';
$human = $_POST['human'];
$submit = $_POST['submit'];
$body ="From: $firstname
$lastname
Email: $email
Message:
$message";
if ($_POST['submit'] && $human == '4') {
if (mail ($to, $subject, $body)) {
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>';
}
?>
</div>