aSchrum Posted April 4, 2008 Share Posted April 4, 2008 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. Link to comment https://forums.phpfreaks.com/topic/99585-php-cookies/ Share on other sites More sharing options...
GingerRobot Posted April 4, 2008 Share Posted April 4, 2008 How about posting the code you've tried and what happened when you did. Link to comment https://forums.phpfreaks.com/topic/99585-php-cookies/#findComment-509459 Share on other sites More sharing options...
aSchrum Posted April 4, 2008 Author Share Posted April 4, 2008 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"; } It was giving me a message "Could not set cookie" Link to comment https://forums.phpfreaks.com/topic/99585-php-cookies/#findComment-509463 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.