Page 1 of 1

Header erros

Posted: Wed Jul 04, 2007 11:04 am
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?

Posted: Wed Jul 04, 2007 11:06 am
by superdezign
Headers are sent automatically when any output is made. i.e. echo().

Posted: Wed Jul 04, 2007 11:17 am
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.

Posted: Wed Jul 04, 2007 11:27 am
by volka
The warning message tells you exactly where the output started.

Posted: Wed Jul 04, 2007 11:37 am
by pinehead18
yeah they point me to that code i posted.

It doesn't like itsself?

Posted: Wed Jul 04, 2007 11:40 am
by volka
please post the complete warning message.