If anyone got the time to read this..

I have been learning Php and i can not seem to put my finger on what i am doing wrong with the include.
If someones got time could you help and i hope i have posted this in the right place.
I have also tried include ‘footer.php’; and that seems to be the same.
And yeah the file is also called footer.php it worked fine when i have done it in the past but i have not done php in some time now.

<!doctype html>

<div id="header">header</div>
<div id="leftnav">left</div>
<div id="body">body</div>

<?php
include("footer.php");
?>

I normally do this:

[php]<!doctype html>

header
left
body
<?php include("footer.php"); // [/php] Usually this contains the closing HTML tags and bottom portion that doesn't change from page to page.

It still wont show?
I dont get why this is not working because iv looked at my old work and its always the same.

Make sure that footer.php is located in the same place as the index page, or that the path to footer.php is correct in the include and that the index page is called index.php.

I suspect you may be working out of a subdirectory of the root directory. Add a ./ right before footer.php if footer.php is in same directory.

./footer.php

Or if in a subdir of your calling file

./foldername/footer.php

Without the ./ PHP will look in the root directory for your file as you have written it. Same thing with your CSS file. The period tells the server to start looking from the directory you are in.

Thanks guys but when i was checking everything over my XAMPP crashed so i thought i would reinstall it and now everything seems to be working fine.

Thanks for all your replies, this site is great for learners.

Sponsor our Newsletter | Privacy Policy | Terms of Service