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 Creating the Menu and Footer Using Variables for the Title Tag

index.php doesn't define $pageTitle

I followed along and contact and shirts both displayed title correctly, but index.php will not. I cut my php $pageTitle and header include from contact.php (so index.php should also say "Contact Mike"), but, after saving, I get the title as

<br /> <b>Notice</b>:Undefined variable: pageTitle in <b> C:\xampp\htdocs\inc\header.php</b> on line <b> 3 </b> <br/>

Why doesn't index.php define $pageTitle?

2 Answers

Can you include the markup for index.php?

Is your $pageTitle variable defined on the index.php page? It appears that it isn't since you are getting that error. If you share your code we can take a better look at the issue and help you address it, but make sure that at the top of your index.php file you have defined the $pageTitle variable.