samoht Posted October 9, 2009 Share Posted October 9, 2009 Hello all, I was wondering if I could get some help setting a cookie based on a selection from landing page. I then want to unset that cookie once a user navigates away from the site Or they return to the landing page. Will I need to use Ajax if there is a selection involved?? Thanks for any help, Quote Link to comment https://forums.phpfreaks.com/topic/177138-solved-cookie-help/ Share on other sites More sharing options...
waynew Posted October 9, 2009 Share Posted October 9, 2009 Why not use sessions? Quote Link to comment https://forums.phpfreaks.com/topic/177138-solved-cookie-help/#findComment-934033 Share on other sites More sharing options...
samoht Posted October 9, 2009 Author Share Posted October 9, 2009 not sure how to set the sessions variable Quote Link to comment https://forums.phpfreaks.com/topic/177138-solved-cookie-help/#findComment-934035 Share on other sites More sharing options...
samoht Posted October 10, 2009 Author Share Posted October 10, 2009 can I just create the form and with each input button say session_register("locale"); <input name=here type=button value=here onclick=window(mysite.php) /> <input name=there type button value=there onclick=window(mysite.php) /> then on mysite.php if(isset($_POST['here'])) $locale = $_POST['here']; else $locale = $_POST['there']; Quote Link to comment https://forums.phpfreaks.com/topic/177138-solved-cookie-help/#findComment-934059 Share on other sites More sharing options...
ameyemad Posted October 10, 2009 Share Posted October 10, 2009 $_SESSION["locale"] = $_POST['here']; will also work Quote Link to comment https://forums.phpfreaks.com/topic/177138-solved-cookie-help/#findComment-934111 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.