No Worries, I know when people post the same questions over and over again, it pisses a lot of the folks here off. I really do read other messages first and then post only when I can't figure out the answer from other posts.
I appreciate your input. It makes more sense when you explain what the browser sees as output. Thanks again. ...Brad "John Holmes" <[EMAIL PROTECTED]> wrote in message news:000f01c21cbd$7f49e0e0$b402a8c0@mango... > Sorry if I was a little rude. The thing to remember that anything > outside of a <? And ?> is considered output, even if it's in an include. > So if I have an include that does <? $var = 'value'; ?>, then I'm fine. > But if I have an include that does <p>Hi<p>, or <html>, or even just a > space within it outside of a <? And ?>, it's going to be considered > output. and any output before a header() call is going to break it > (unless output buffering is on). > > ---John Holmes... > > > -----Original Message----- > > From: Brad Melendy [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, June 25, 2002 10:39 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] Re: One more 'Headers Already Sent' error. :-( > > > > Oh I read all the error messages, I just don't understand them. ;-) > I'm > > working through a book "Teach Yourself PHP4 in 24 Hours" so much of > this > > is > > new to me. I think I understand now and it makes sense that by > putting > > the > > include statement farther down in the page so that it wasn't being > > executed > > until after the header function in the fist portion of code. Thanks > for > > your help. > > > > ....Brad > > > > "John Holmes" <[EMAIL PROTECTED]> wrote in message > > news:000101c21ca8$5040e970$b402a8c0@mango... > > > If header.html has HTML in it, THEN THAT IS OUTPUT! You can't send a > > > header after output. Do you even read the error message? It says > OUTPUT > > > STARTED AT > /home/bmelendy/websites/www.e-learn.net/quizD/header.html:3. > > > THAT MEANS LINE 3 STARTED OUTPUT... > > > > > > ---John "been a long day, deal with it!" Holmes... > > > > > > > -----Original Message----- > > > > From: Brad Melendy [mailto:[EMAIL PROTECTED]] > > > > Sent: Tuesday, June 25, 2002 6:08 PM > > > > To: [EMAIL PROTECTED] > > > > Subject: [PHP] Re: One more 'Headers Already Sent' error. :-( > > > > > > > > Well, I have traced this down to line 4 in the following code > > > > 'include("header.html");' which just includes my navigation bar. > If I > > > > comment it out, everything works great, if I leave it in, I get > the > > > error > > > > Headers Already Sent. The file it purely html. What could be the > > > > problem?? > > > > Thanks in advance! > > > > > > > > <?php > > > > error_reporting(2039); > > > > include("dblib.inc"); > > > > include("userlib.inc"); > > > > include("header.html"); > > > > $message=""; > > > > if ( isset( $actionflag ) && $actionflag == "login" ) > > > > { > > > > if ( empty( $form[login] ) || empty( $form[password] ) ) > > > > $message .= "You must fill in all fields<br>\n"; > > > > if ( ! ( $row_array = checkPass( $form[login], $form[password] ) > ) ) > > > > $message .= "Incorrect password. Please try again<br>\n"; > > > > if ( $message == "" ) // we found no errors > > > > { > > > > LastLogin($row_array[login]); > > > > cleanSession( $row_array[id], $row_array[login], > > > $row_array[password] > > > > ); > > > > header( "Location: index.php?".SID ); > > > > } > > > > } > > > > ?> > > > > > > > > > > > > "Brad Melendy" <[EMAIL PROTECTED]> wrote in message > > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > 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 > > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php