kiowa_jackson Posted February 21, 2008 Share Posted February 21, 2008 I want someone who is coming in with the link www.mydomain.com/index.php?msg=1 to get a cookie set called msg with the value 1. I tried using this: <?php $days = 360; $time = time() + ($days * 86400); setcookie('msg', $msg, $time); ?> but to no avail. Can someone tell me what I need to change to make it work? Thanks Link to comment https://forums.phpfreaks.com/topic/92308-tryin-to-set-this-here-cookie/ Share on other sites More sharing options...
Chris92 Posted February 21, 2008 Share Posted February 21, 2008 use $_GET to get the stuff from the query string: <?php $days = 360; $time = time() + ($days * 86400); setcookie('msg', $_GET['msg'], $time); ?> Link to comment https://forums.phpfreaks.com/topic/92308-tryin-to-set-this-here-cookie/#findComment-472953 Share on other sites More sharing options...
kiowa_jackson Posted February 21, 2008 Author Share Posted February 21, 2008 Thanks! Link to comment https://forums.phpfreaks.com/topic/92308-tryin-to-set-this-here-cookie/#findComment-472958 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.