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

Echoing a HTML Page

I found a tutorial for submitting forms on the treehouse blog that uses a php file. In that file, it echoes text when there is an error or when the submission is successfully sent. The current code uses plain text but I would like it to echo a html page that I've customized to match my site. I'm not sure how to properly write it since I'm not that experienced.

The current line of code is as follows:

if ( empty($name) OR empty($phone) OR empty($message) OR !filter_var($email, FILTER_VALIDATE_EMAIL)) {
    http_response_code(400);
    echo "Oops! There was a problem with your submission. Please complete the form and try again.";
    exit;
}

Any help would be greatly appreciated. Thank you.

1 Answer

Take a look at this course - first badge.

Yes, that worked. Thank you.