On 13 Apr, 13:15, Suman <YoS...@gmail.comwrote:
Quote:
Hi All,
>
I am trying to experiment with sessions and they seem to be resetting
everytime i visit the page.
>
here is the code of the page
>
<?php
session_start();
$count = $_SESSION["counter"] + 1;
$_SESSION["counter"] = $count;
echo $_SESSION["counter"];
?>
>
if I refresh the page, the count doesn't increase. Whast should i do
to fix this?
>
any help is much appreciated
Find the problem - the code is fine. But the most common cause of
cookie related problems is output before a header or cookie realted
statement - PHP is very good at intercepting and reporting this - why
have you not checked your logs? Do you know how errors are recorded/
reported?
Even if that turns up nothing - you should look at the HTTP data
passing to and from the browser - you can use firebug or tamperdata
for Firefox, or iehttpheaders for MSIE. Or just sniff the traffic with
wireshark. Then you can verify if the server is presenting a cookie,
and if the browsers retruns it in subsequent requests.
C.