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

Error after 'Adding Active States' video

So, I've completed the video. I believe my code is fine, semi-colons and all. On reloading the site, I get this - http://grab.jellybabi.es/jLHw

Any help?

2 Answers

To be a bit more helpful, it works flawlessly on the shirts and contact pages, where I have defined $section. In index.php, this error occurs.

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

The error happens because the $section variable is undefined. (These errors don't always display on the screen; it depends on how the server is configured.)

You must not have a $section variable specified in the index.php. I'll recheck the videos, but I thought I had this code in index.php to address that:

$section = "home";

Adding that code to index.php before the header is included eliminate the error message.