xiao Posted April 22, 2008 Share Posted April 22, 2008 Is it normal that all session variables get lost when the page is being refreshed? Quote Link to comment Share on other sites More sharing options...
phpSensei Posted April 22, 2008 Share Posted April 22, 2008 Depends if your setting the session, without the session_start on top, then refreshing it, then no. Post your code. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted April 22, 2008 Share Posted April 22, 2008 Are you setting your session variables equal to something from $_POST EVERY time the script runs? That'll cause you to overwrite your session vars with blank vars every time you refresh because the post data is gone. =P Quote Link to comment Share on other sites More sharing options...
xiao Posted April 22, 2008 Author Share Posted April 22, 2008 if(($_POST['processor'] != "(Make a choice)") && ($_SESSION['processor'] != $_POST['processor'])){ $_SESSION['processor'] = $_POST['processor']; } So it shouldn't overwrite everytime, right? It does though. i have a session_start(); (tried to remove it and got quite some errors) I don't have a session_destroy anywhere. I don't really get it... Quote Link to comment Share on other sites More sharing options...
DarkWater Posted April 22, 2008 Share Posted April 22, 2008 if(($_POST['processor'] != "(Make a choice)") && ($_SESSION['processor'] != $_POST['processor'])){ $_SESSION['processor'] = $_POST['processor']; } So it shouldn't overwrite everytime, right? It does though. i have a session_start(); (tried to remove it and got quite some errors) I don't have a session_destroy anywhere. I don't really get it... Yeah, because when you have a blank $_POST, $_POST['processor'] isn't "(Make a choice)", it's NULL. Get it? Quote Link to comment Share on other sites More sharing options...
xiao Posted April 22, 2008 Author Share Posted April 22, 2008 hmm, makes sense Thanks. makes me able to do another 20 minutes of programming. I'll be back with another silly question in a few minutes Quote Link to comment 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.