Header erros

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Header erros

Post by pinehead18 »

Sure, its probably one of the most asked questions but i can't find any information on the net about it.


I setup a username and login that creates a session called username.

session_start();
if (isset($_SESSION['username'])) { echo "yay"; } else { echo "boo"; }


Is what i'm using now to test it and i'm getting headers already sent error.

Can someone either link me an indepth detail about what this means and how i should post this code, or tell me?

Thanks

O yeah, i put this at the very top of my include file so nothing should be in front of it.

Why would i still be getting this error?
Last edited by pinehead18 on Wed Jul 04, 2007 11:06 am, edited 1 time in total.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Headers are sent automatically when any output is made. i.e. echo().
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Post by pinehead18 »

I put that code above everything, even the first code and i'm still getting header errors.

Echo doesn't occur till after it.

I took out the echo's in the if statement too.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

The warning message tells you exactly where the output started.
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Post by pinehead18 »

yeah they point me to that code i posted.

It doesn't like itsself?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

please post the complete warning message.
Post Reply