Hi guys. It's been a third day now, I am having problems with header. I have many included files which output echo before the header, so since I can't output them after the header, I used ob_start(); and ob_flush(); but still I am getting header problems.

If you wanted to created a login code. In which if user enters wrong credietials you might use echo "error";
but it is not working before, echo is being outputted before the header.

Anyone has any solutions for the problem?

Member Avatar for LastMitch

@Vribium

It's been a third day now, I am having problems with header. I have many included files which output echo before the header, so since I can't output them after the header, I used ob_start(); and ob_flush(); but still I am getting header problems.

Can you post the header code.

try this:

avoid <? ?> should be <?php ?> depends if your php.ini allowed the use of <? ?>

Yes i also need header code in php.

I had placed ob_start() is the middle, but when I placed it at the VERY top of my codes, it worked just fine. Thank you.

But, it is a good idea to close ob_start() with ob_flush? The site, seems to work just fine without it? Can i leave it there, without expection something bad to happen?

Member Avatar for diafol

You can usually go without ob functions for header redirects if the header appears before any output (php generated or html).

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.