PHP 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
aml391
Forum Newbie
Posts: 2
Joined: Mon Apr 07, 2008 1:18 pm

PHP COOKIES!!

Post by aml391 »

I need help hooking up a php cookie. I have tired many different options but can't get anything to work. I am trying to get setup the cookie to remember this pages login section. http://www.lknrealtygroup.com/searchForm2.php So, when the user goes back to the page later on in the day they don't have to fill it out it will take them straight to this page. http://www.lknrealtygroup.com/searchByArea.php Would love the help. Thanks.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: PHP COOKIES!!

Post by John Cartwright »

What have you tried?

Have to looked at setcookie()?
aml391
Forum Newbie
Posts: 2
Joined: Mon Apr 07, 2008 1:18 pm

Re: PHP COOKIES!!

Post by aml391 »

I have tired this

if (!isset($_COOKIE['lknCookie'])) {
// if a cookie does not exist
// set it
$hourdiff = "3"; $melbdate = date("l, d F Y h:i a",time() + ($hourdiff * 3600));
setcookie("lknCookie", "$melbdate", mktime()+86400*30, "/") or die("Could not set cookie");
$msg3 = "Cookie 3 Set.";
}
else {
// if a cookie already exists
$msg3 = "Cookie 3 Already Set";
}

No I have not yet tired setCookie();
Post Reply