Re: $_session/$_cookie trouble

From: Date: Tue, 28 Apr 2009 19:29:56 +0000
Subject: Re: $_session/$_cookie trouble
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-292103@lists.php.net to get a copy of this message
Igor Thanks for the link. It was suggested that I must put the session_start() before all code on the parent page. I am no longer getting the error messages,so I am assuming I am making progress, however I have yet to be able to get the $_SESSION or $_COOKIE to produce results...such as the ability to echo them. Thanks for your help. Gary "Igor Escobar" <titiolinkin@gmail.com> wrote in message news:1f5251d50904281208g35fcc98t696b51a4bfc74a03@mail.gmail.com... > > http://www.tech-recipes.com/rx/1489/solve-php-error-cannot-modify-header-information-headers-already-sent/ > > > Regards, > Igor Escobar > Systems Analyst & Interface Designer > > -- > > Personal Blog > ~ blog.igorescobar.com > Online Portifolio > ~ www.igorescobar.com > Twitter > ~ @igorescobar > > > > > > On Tue, Apr 28, 2009 at 3:59 PM, Ashley Sheridan > <ash@ashleysheridan.co.uk>wrote: > >> On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: >> > I am trying to set a cookie and a session, but seem to be running into >> > a >> > wall. >> > >> > I have tried different variations, and keep getting the same error >> message >> > >> > If I have this >> > >> > <?php >> > >> > session_start(); >> > >> > I get this: >> > Warning: session_start() [function.session-start]: Cannot send session >> > cookie - headers already sent by (output started at >> > C:\xampp\htdocs\weiss\assessresult.inc.php:2) in >> > C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 >> > >> > Warning: session_start() [function.session-start]: Cannot send session >> cache >> > limiter - headers already sent (output started at >> > C:\xampp\htdocs\weiss\assessresult.inc.php:2) in >> > C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 >> > >> > If I have this: >> > session_start(); >> > >> > setcookie('sale_cookie','$sale_value', time()-3600); >> > setcookie('assess_cookie','$assess_value', time()-3600); >> > I get this >> > >> > >> > Warning: session_start() [function.session-start]: Cannot send session >> > cookie - headers already sent by (output started at >> > C:\xampp\htdocs\weiss\assessresult.inc.php:2) in >> > C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 >> > >> > Warning: session_start() [function.session-start]: Cannot send session >> cache >> > limiter - headers already sent (output started at >> > C:\xampp\htdocs\weiss\assessresult.inc.php:2) in >> > C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 >> > >> > Warning: Cannot modify header information - headers already sent by >> (output >> > started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in >> > C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 >> > >> > Warning: Cannot modify header information - headers already sent by >> (output >> > started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in >> > C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 >> > >> > If I delete and start over, I stll get the "headers already sent"... I >> have >> > tried numerous other variations, but all with the same error. >> > >> > What am I missing here? >> > >> > Thanks >> > >> > Gary >> > >> > >> > >> I would have thought it was obvious, the file assessresult.inc.php is >> being called before your session_start(). Have you put your code before >> every include? >> >> >> Ash >> www.ashleysheridan.co.uk >> >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >

« previous php.general (#292103) next »