Hi All,
I know this has come up before and I've read some posts so far, but this is
still eluding me.

I have come to understand that typically, if you are getting an error
message about your headers having already been sent to the browser, you are
writing bad code.  Now, I want to right good code so I really want to figure
this out the right way and stay away from doing stuff like setting Output
Buffering to ON in the php.ini file, (which I can do in my case).

So, basically, I get the error message:

"Warning: Cannot add header information - headers already sent by (output
started at /home/bmelendy/websites/www.e-learn.net/quizD/header.html:3) in
/home/bmelendy/websites/www.e-learn.net/quizD/login.php on line 17"

Now, I can see right on line 17 that I'm outputting a header with the
following line:

header( "Location: index.php?".SID );

This is part of an if/then statement that is supposed to redirect the user
to index.php upon login.  The conflict occurs because I have an include file
with a function checkUser() that also redirects the user to the login.php
page if they fail the the check with a line:

header( "Location: /main/login.php" );

So, is there no way for me to redirect a user from both a function under
certain circumstances and also from withing a page that calls that function?
I don't completely understand when exactly the headers are being sent and
this does all work properly if I turn the Output Buffering to 'ON' in the
php.ini file, but I'd like to try to make this work the 'right' way rather
than cut corners and just make the server work for my code, instead of
making my code work for the server.  ;-)

Thanks very much for any input.

...Brad



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to