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 Including the Header

Dr.P reon
Dr.P reon
8,562 Points

contact page is not working!

My contact link is not working. My header and contact page starts with include statements which for some reason is not displaying in text area. I can assure you there are accurately written. My contact and header page looks like this.

header page

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

<html>
<head>
    <title><?php echo "Shirts 4 Mike"; ?></title>
    <link rel="stylesheet" href="css/style.css" type="text/css">
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald:400,700" type="text/css">
    <link rel="shortcut icon" href="favicon.ico">
</head>
<body>

    <div class="header">

        <div class="wrapper">

            <h1 class="branding-title"><a href="./">Shirts 4 Mike</a></h1>

            <ul class="nav">
                <li class="shirts"><a href="#">Shirts</a></li>
                <li class="contact"><a href="contact.php">Contact</a></li>
                <li class="cart"><a href="#">Shopping Cart</a></li>
            </ul>

        </div>

    </div>

    <div id="content">

contact Page:

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

    <div class="section page">

     <h1>Contact</h1>

    </div>

The contact page wont load by on the browser. Each time I refresh localhost, it displays localhost#. I dont know what I am doing wrong. Thanks in advance for trying to help me!

Robert Wasinger
Robert Wasinger
12,385 Points

If I'm reading this correctly, it would appear that your header.php file is including itself. This creates a loop that won't load. Try removing the include from your header file.

Dr.P reon
Dr.P reon
8,562 Points

I have removed the include from my header file, it still wont work :(

2 Answers

With your navigation can you take a screen shot of the different files within the project so I can see if it might be a spelling error, because your link should open the contact.php file just fine if that is the directory that it is in. However if it is not in the same directory that the index.php is located in you will need to point it to the correct directory.

Please get some screenshots, and then if the issue is not resolved I will see if I can help you any further.

Also just glancing at it one more time I noticed you are including your header.php into your header.php. You should not include a file into its self, if I am looking at that wrong again let me know so I can help you out.

Dr.P reon
Dr.P reon
8,562 Points

hi Johnathan, I am so grateful, for your quick reply. I tried to copy and paste my screen shots in the text area, but it is not working. is it possible I share the pictures with you on dropbox, or google. Or if you know of any other means I can share the files with you. Thank you so much....

As regards to the last statement, my header.php file is in my include php folder (inc) and the contact. php file is in the htdocs.

If you could go to https://www.join.me and then click share screen, then provide me with the link that they give you I would be more then happy to take a look, and see if we can't get you going.