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! While you're at it, check out some resources Treehouse students have shared here.

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

PHP Build a Simple PHP Application Wrapping Up The Project Using A Third-Party Library

Bob Sutherton
Bob Sutherton
20,160 Points

Did I miss a step somewhere? Why does my code at the top of contact.php look different from Randy's?

This is the code at the top of my contact.php file. If you look at the course video (2:50) alongside this question you can see that Randy's code looks different.

<?php 
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;
}

?>

1 Answer

Joel Bardsley
Joel Bardsley
31,249 Points

Hi Brock, you may have possibly missed this part: validating contact form data

Bob Sutherton
Bob Sutherton
20,160 Points

Thanks Joel, that looks like what happened.