I am working on a website where it is possible for the current user to choose different cities to look in.. I don’t want to keep the city in the URL and I don’t want to depend on a cookie, if the client will not accept cookies.. I am doing it in sessions then, but somehow the session stops very early and I don’t understand what is wrong..
if (isset($_GET['c'])) {
unset($_SESSION['city']);
$_SESSION['city'] = $_GET['c'];
}
if (empty($_SESSION['city'])) {
$_SESSION['city']='07400';
}
$city = $_SESSION['city'];
after I click three pages around, the the city is back to 07400.. In some way.. the Session gets empty.. but I don’t know how…
After working on the script long enough, I found out, that nothing was wrong with the city script… Nothing was wrong with the Sessions.. But because of a scripting mistake later in the script, it destroyed the $_SESSION[‘city’].. Thanks for all the replies.. And thanks for the tips to look for mistakes, and maybe a changed session id…