$sale_value would have worked if it hadn't been in single quotes, I believe. (Assuming it was populated.). When you put it in quotes, you were making the cookie's value a string instead of a variable. So, the value would actually have literally been $sale_value, rather than the value for that variable. It is working with $_POST['sale'] because there are no single quotes. :-p. On Tue, Apr 28, 2009 at 6:46 PM, Gary <gwpaul@xxxxxxx> wrote: > 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 > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php