Cookies, PHP, and refreshing
OK, I'm working on a modification to a webpage where I need to set cookies for a particular functionality. Having worked with cookies & PHP before, I know that the cookie value will not take until AFTER the page is refreshed. Since this cookie will be set on every page, I don't really want to refresh it everytime. So, I want to now if I jsut setCookie, then the user clicks a link, will that be sufficient, or do I really need to find a different way to do this? Secondly, if I setcookie, don't refresh, and then the user goes to a new website, sy by either a click to the new site, or by entering an address in the address bar, will the cookie remain intact (it's going to be a session variable, so I don't care once they close their browser.)?
TG
Re: Cookies, PHP, and refreshing
I'm pretty confused as to what you want. What data is being saved in the cookie? Is it login information (my best guess since you're resetting it everytime)?
Quote:
Originally posted by techgnome
So, I want to now if I jsut setCookie, then the user clicks a link, will that be sufficient, or do I really need to find a different way to do this?
What will the link go to? Will it just be a link to the current page (a way to refresh)? If so, yes.
Quote:
Originally posted by techgnome
Secondly, if I setcookie, don't refresh, and then the user goes to a new website, sy by either a click to the new site, or by entering an address in the address bar, will the cookie remain intact (it's going to be a session variable, so I don't care once they close their browser.)?
Cookies will stay for as long as you set them. The default expires when the browser window closes (not when they navigate away).
I'm not sure if I'm helping you at all with any of this, since I'm still confused. :(