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

Vicki Greer
Vicki Greer
5,020 Points

Can't complete Task 1 of challenge "Include PHP"

I can't complete this challenge. I get an error saying that I haven't included the file correctly, even though the code works in the Preview window.

Here's the link to the challenge: https://teamtreehouse.com/library/php-basics-2/php-on-the-web/including-php

I don't see a way to include a screenshot here, so I'll do a little copying and pasting.

The code: <html> <head> <title>A Few of My Favorite Things</title> </head> <body> <h1>A Few of My Favorite Things</h1> <?php include "favorites.php" ?>

</body> </html>

And the exact text of the error message: Bummer! Make sure you INCLUDE the "favorites.php" file

I've tried restarting the exercise, logging out of Treehouse and logging back in, clearing my browser cache. I'm running Windows 8.1. I had the same problem with a previous exercise, but when the machine rebooted after a power failure, I couldn't recreate the error.

1 Answer

andren
andren
28,558 Points

The code challenges can at times be pretty picky not just about the result of your code but also how the code itself looks. In this case it expects your include statement to be terminated by a semicolon, which you have not done. If you add a semicolon like this:

<?php include "favorites.php"; ?>

Then it will work.

Vicki Greer
Vicki Greer
5,020 Points

Okay, that was a dumb beginner mistake. Thank you for helping me find it!