RE: Validation and session variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> --- Chris Shiflett <shiflett@xxxxxxx> wrote:
>
> > On each page, it might be good to add some debugging
> > information near the
> > top (where session_start() is):
> >
> > <?php
> > session_start();
> > echo '<pre>' . htmlentities(print_r($_COOKIE, true))
> > . '</pre>';
> > echo '<pre>' . htmlentities(print_r($_GET, true)) .
> > '</pre>';
> > echo session_id();
> > ...
> >
> I added this in , on top, right under session_start()
> as shown and get this error:
>
> Warning: Cannot modify header information - headers
> already sent by (output started at
> /home/lurkkcom/public_html/page1.php:6) in
> /home/lurkkcom/public_html/page1.php on line 54
>
> So it's clashing with the redirect:
>
> Header ('Location:
> http://www.mysite.com/page2.php?'.SID);
>

If your script outputs anything and then tries to redirect it WILL throw
that error. I believe if you want to do echos AND redirects you'll have to
use output buffering (see the manual: http://uk.php.net/outcontrol) and only
output the buffer if you do not redirect.

HTH
Graham

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux