Hi,

I have seen a lot of people have been having a similar problem to this, but I have not found a solution and so daniweb is the best place to go!

Basically, whenever I use:

<?php
include_once "Filename.php";
?>

which I often do for the header, navigation and footer of a website it works fine. But when I upload the website, these sections have a margin-top of around 24px; I can simply fix the problem by adding -24px to the css to counteract the problem, however, this makes content appear in the wrong place when testing it offline.

Can anyone shed some light on this problem?

Many Thanks

Check if you have sent to buffer any of new line space, ex: \r or/and \n.
Be sure, before you open or after close PHP tag, you have no left any space or data you don't need, like:

data wrong place
<?php // code ?>
data wrong place

If you are using a free hosting, it may be the place of some automatic insertion scripts to trace/stats/advertising.

Check if you have sent to buffer any of new line space, ex: \r or/and \n.
Be sure, before you open or after close PHP tag, you have no left any space or data you don't need, like:

data wrong place
<?php // code ?>
data wrong place

If you are using a free hosting, it may be the place of some automatic insertion scripts to trace/stats/advertising.

Thankyou!

The problem was that the code on the page to be included started on line 2 and was indented. Removing that fixed it perfectly, cheers

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.