Hello,
See this Cookie Code and Iam getting errors. But it should work fine. I taken it from book only.
===========================================
<?php
$days = 1;
$expires = time()+($days * 86400);
if($sitevisits) {
$sitevisits++;
// now we need to set the cookie with the new value
setcookie("sitevisits", $sitevisits, $expires);
} else {
// this must be a new visitor, so set initial cookie
setcookie("sitevisits", 1, $expires);
}
?>
<BODY>
<script language="php">
print("Thank you for visiting this page $sitevisits times!");
</script>
</BODY>
============================================
Iam Getting the following error in my browser:
Warning: Undefined variable: sitevisits in C:\Inetpub\wwwroot\creatriznet_new\dbin.php on line 5
Warning: Cannot add header information - headers already sent by (output started at C:\Inetpub\wwwroot\creatriznet_new\dbin.php:5) in C:\Inetpub\wwwroot\creatriznet_new\dbin.php on line 11
Warning: Undefined variable: sitevisits in C:\Inetpub\wwwroot\creatriznet_new\dbin.php on line 18
Thank you for visiting this page times!
So please see this code and check any wrong in the code of cookies.
I think, there is no wrong but it is not working in my system. May be other reasons
So please just check it and reply.
Regards
K.srinivas
katkurisrinivas@forindia.com