Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Trent Burkenpas
22,388 PointsIm trying to set up a contact form to send the form to a email, then say Thanks!
Ok so i'm stuck on the project where you make the contact form and it sends it to the email and then directs you to a Thank you page. But I have reached the end of the videos and when I send the form it just takes me to a blank page. I look for hours what could be wrong with my code and i cant find anything.
if ($_SERVER["REQUEST_METHOD"] == "POST") { $name = $_POST["name"]; $email = $_POST["email"]; $message = $_POST["message"]; $email_body = ""; $email_body = $email_body . "Name: " . $name . "\n"; $email_body = $email_body . "Email: " . $email . "\n"; $email_body = $email_body . "Message: " . $message;
// TODO: Send Email
header("Location: contact.php?status=thanks"); exit;
} ?><?php include('inc/header.php'); ?>
<div class="section_page"> <div class="wrapper">
<h1 class="contact">Contact</h1>
<?php if (isset($_GET["status"]) AND $_GET["status"] == "thanks") { ?>
<p>Thanks for the email! I’ll be in touch shortly.</p>
<?php } else { ?>
<p class="contact_note">I'd love you hear from you! Leave a message, and I will be in touch very soon.</p>
<form method="post" action="contact.php">
<table class="contact_form">
<tr>
<th>
<label for="name">Name</label>
</th>
<td>
<input type="text" name="name" id="name">
</td>
</tr>
<tr>
<th>
<label for="email">Email</label>
</th>
<td>
<input type="text" name="email" id="email">
</td>
</tr>
<tr>
<th>
<label for="message">Message</label>
</th>
<td>
<textarea name="message" id="message"></textarea>
</td>
</tr>
</table>
<input class="contact_btn" type="submit" Value="Send">
</form>
<?php } ?>
</div>
</div>
</div>
<?php include('inc/footer.php'); ?>
1 Answer

Joel Rivera
29,401 PointsI found this site useful. http://myphpform.com/ It will show you step by step what to do. Hope it helps.
Trent Burkenpas
22,388 PointsTrent Burkenpas
22,388 PointsThanks for the response, I just had a whitespace error and that fixed it !