Simple Coding Problem with $HTTP_COOKIE_VARS
Posted: Fri May 14, 2010 1:32 am
I have written the following code:
this code should preview like this:
and when i will reload the page the '1' will change to '2' and then to '3' and so on.
However when i reload the page it still remains '1' and doesnt show '2'.
is anything wrong in this script?
Code: Select all
<?php
if(empty($HTTP_COOKIE_VARS["times"]))
{
$times=1;
}
else
{
$times=$HTTP_COOKIE_VARS["times"];
$times=$times+1;
}
setcookie("times", $times, time()+3600);
echo "This is your $times visit within an hour";
?>Code: Select all
This is your 1 visit within an hour
and when i will reload the page the '1' will change to '2' and then to '3' and so on.
However when i reload the page it still remains '1' and doesnt show '2'.
is anything wrong in this script?