开发者

Session variables losing value

开发者 https://www.devze.com 2023-03-17 15:17 出处:网络
I am using session variables to store different pieces of information. The minute I redirect using javascript the session variables seem to lose their values. this happens very inconsistanly especialy

I am using session variables to store different pieces of information. The minute I redirect using javascript the session variables seem to lose their values. this happens very inconsistanly especialy in Chrome (other browsers are fine!)

window.location = "../submitOrder.php?custid="+custid;

(in the real code i put in the whole url)

then, starting from the submitOrder my session variables are blank...

what could be the cause of this? does it have to do with the redirect?

I don't mind adding more details of necessary, but the problem is a simple but co开发者_StackOverflow社区nfusing one.

Thank you!


While I am not particularly aware of Chromes behavior regarding Javascript redirects and cookie handling your problem suggests that the session cookie isn't correctly passed onto the serven when you redirect a user via Javascript in Chrome. To whether this really is the case you could make the session id a part of your redirect, i.e.:

window.location = "../submitOrder.php?custid="+custid+"&PHPSESSID="+<?php echo session_id(); ?>;

However I think it is unlikely that such issue exists in Chrome, you probably have a mistake in your code (maybe you forgot to use the start_session() function?)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号