javascript
Brief description  about Online courses   join in Online courses
View Shiney Maria Lewis 's Profile

PHP Cookie Assignment

Hi am not able to get correct output for the third one.
Whenever page refreshes count becomes 1 but it doesn't increment after that.
Please help me in this.
<?php

if(!isset($_COOKIE["UserRef"]))
{
setcookie("UserRef","Ref",time() 3600);
//$count=0;
echo "New";


}
else{
//$count=$count 1;
echo "Refresh";
}
/*if ($_GET["count"]== "no") {

echo "Refresh";
} */
?>

<html>
<head></head>
<body>
<meta HTTP-EQUIV="refresh" CONTENT="5;URL=thirdRefr.php">
<?php
$count=$_COOKIE["UserRef"] 1;

echo $count; ?>
</body>
</html>
Asked by Shiney Maria Lewis | Feb 25, 2011 |  Reply now
Replies (1)
View teacher siliconindia 's Profile
you can try this code

<?php
$count = count($_COOKIE);
$name = "Cookie_".($count+1);
$value = "xxxsss.com";
setcookie($name, $value);
print("<pre>\n");
print("One cookies were added.\n");
print("$count cookies received.\n");
foreach ($_COOKIE as $name => $value) {
print " $name = $value\n";
}
print("</pre>\n");
?>
Mar 8, 2011