XAMPP don't remember cookies

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shamkawai
Forum Newbie
Posts: 7
Joined: Mon Jan 10, 2011 4:09 pm

XAMPP don't remember cookies

Post by shamkawai »

I am using php on xampp locally.
I have created a script

Code: Select all

<?php
$inTwoMonths = 60 * 60 * 24 * 60 + time(); 
setcookie('lastVisit', date("G:i - m/d/y"), $inTwoMonths); 

if (isset($_COOKIE['lastvisit']))
$visit=$_COOKIE['lastvisit'];
else
echo "no cookie yet, come back later </br>";

?>
it runs properly on the browser, no error.
except it will only give me no cookie, no matter how many times i close and reopen the browser to this script.
Thank you!
Last edited by Benjamin on Tue Jan 11, 2011 9:31 pm, edited 1 time in total.
Reason: Added [syntax=php] tags.
kalpesh.mahida
Forum Commoner
Posts: 36
Joined: Wed Oct 06, 2010 7:09 am

Re: XAMPP don't remember cookies

Post by kalpesh.mahida »

cookies are stored on a user's computer by browser. check if storing cookies is disabled or not for your browser.
Post Reply