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

The PHP Basic code challenge that asks you to include the 'favorites' file doesn't except my answer though it's correct

The PHP Basic code challenge that asks you to include the 'favorites' file doesn't except my answer though it's correct .

Even when I preview it within the workspace is works though when I check my work it it states that my code is not correct.

I contacted help support and they say it's working for them so it must be my answer. And I should check out here for an answer.

https://teamtreehouse.com/library/php-basics-2/php-on-the-web/including-php

Challenge Task 1 of 1

Within the current directory, I have created a file named favorites.php that displays a few of my favorite things. Add the php code blocks and include that file so that my favorite things display below the heading.

Here's my 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>

Moderator Edit: Added Markdown formatting to post so the code snippet can be read in the Community Post. Please follow the formatting rules (as provided in the Markdown Cheatsheet) when posting code in the Community.

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hey Michael,

First, I added markdown to your post so that the code snippet is readable in the Community. When posting code, please follow Markdown formatting, otherwise the code is pretty unreadable.

As for your question, you have a syntax error in the line of code. You are missing the semicolon to close the statement. Semicolons are vital in PHP code, and missing just one will often 'break' the code. Once you put in the semicolon, the code will pass.

Keep coding! :dizzy: