Hi there, I have little problem. I have class named listing - for product listing and I have few sections. I want to reset filter when Im in another section. I made it this way, but its not working.. I cant fill $_SESSION['sekc'] with actual value... Can anybody tell me why? Thanks... class listing { function __construct($section) { $this->section = clean_text($section); echo 'old - ' . $_SESSION['sekc'] . '<br />'; //Print old sekc - never changes echo 'new - ' . $this->section . '<br />'; //Print new section if ($_SESSION['sekc'] != $this->section) { //some unsets.... } unset($_SESSION['sekc']); echo $this->section; //Print correct value, the new section $_SESSION['sekc'] = $this->section; echo $_SESSION['sekc']; //Print correct value, the new section, but on another page reload I see the old value at top of the script. (ie: If i came from index, on top I see index and here I see the new value.) } } PHP: Class calling: $listing = new listing('index'); PHP: and in another scripts Im changing the value (index).
Its there and server is using session.autostart. EDIT: Hmm, bug is somewhere in the script, but not in these few lines... If I use them alone, all is ok, but in website nope...
Ouch, FAIL... I was calling this class in index.php and I had "ErrorDocument 404 /" in my htaccess. So when the error 404 was called, it calls index and it overwrites session....