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

2 Headers instead of 1 on "Build a simple PHP application"

I have been following along with the "Build a simple PHP application" I'm in the creating the Menu & Footer, the video where I got stuck is "Including the Header".

When I follow along with the video, I end up with two headers instead of one. What could I be doing wrong?

2 Answers

What could I be doing wrong? Hard to say without seeing your code.

Did you remember to remove the static html code for the header, when you added in the php code for the header?

As James mentioned. It is possible you have kept the original header content in the index.php file. As long as you have copied the content from your header and added it to a new header.php file. you can now replace the original content with:

<?php include('inc/header.php'); ?>

This tag grabs the file header.php and prints it's content in place of the php tag. Now you can add this include tag anywhere you want the header to appear.