On Tue, 26 Mar 2002, andy wrote: > I am wondering if it is possible to send a cookie and read it on the same > page. > > Following environment: > > There is a cookie already on the machine of the client, but expired. > Now I am setting a new cookie and reading it on the same page via $sess_id = > $HTTP_COOKIE_VARS[$sesscookiename]; > > Unfortuanaelly it gives me the old session id back. After refreshing I am > getting the new sessid and everything works fine. The cookie has been sent > with the right value, I did dubble check it. But the HTTP_C... reads the old > one.
An HTTP request (the transaction between browser and server) always goes like this: 1) The browser sends a request. 2) The server sends a response. That's it. This creates certain constraints. The browser sends the appropriate cookies (those in the right domain) to the server along with its request. The server then sends any new cookies back to the browser as part of its response. There is no chance for the server to re-read the cookies from the browser after step 2 above, unless, as you've observed, you refresh the page, which in effect just repeats both steps. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php