JayVee Posted September 19, 2008 Share Posted September 19, 2008 How do I make a cookie expire at the end of a session? When i try setcookie('cookiename', 'yes', time() + 0); or setcookie('cookiename', 'yes', 0); the cookie expires instantly. Quote Link to comment https://forums.phpfreaks.com/topic/124939-cookie-expire-at-end-of-session/ Share on other sites More sharing options...
discomatt Posted September 19, 2008 Share Posted September 19, 2008 Try setcookie('cookiename', 'yes'); Though setcookie('cookiename', 'yes', 0); should work... and works for me. Quote Link to comment https://forums.phpfreaks.com/topic/124939-cookie-expire-at-end-of-session/#findComment-645553 Share on other sites More sharing options...
.josh Posted September 19, 2008 Share Posted September 19, 2008 if you want a cookie to expire at the end of a session, just use session vars, cuz that's the diff between session vars and cookies. Quote Link to comment https://forums.phpfreaks.com/topic/124939-cookie-expire-at-end-of-session/#findComment-645554 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.