Re: $_session/$_cookie trouble

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

 



Many thanks to all for persevering my ignorance!

I had read that setting a cookie into the  past would destroy the cookie 
once the browser session was over, so that is why I had set it that way.

I did two things to solve the problem, and I frankly dont know which one (or 
both) it was.

First I reset the expiration into the future

Next I changed
setcookie('sale_cookie','$sale_value' time()-3600);    to
setcookie('sale_cookie',$_POST['sale'] time()+3600);

So I was pulling the information from the post instead of the variable.

$sale_value=$_POST['sale'];

So again, thanks for all your help.

Gary


""Gary"" <gwpaul@xxxxxxx> wrote in message 
news:EB.4E.29799.53717F94@xxxxxxxxxxxxxxx
>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
> 



-- 
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