Not Saving Session - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Not Saving Session (/showthread.php?tid=60284) |
Not Saving Session - El Forum - 02-22-2014 [eluser]ricmen[/eluser] Hi Everyone I have I little frustrating issue, I have a function in my client_controller called Paid, this function has a validation that retrieves the userId from the $this->session->userdata("user_session"), and this works for the first time, the weird thing here is when I do a post back to that function the session is cleared, I already check my code and I don't have any unset_session or something that destroy the session, I always load the library $this->load->library("session"). at the beginning of the controller. any ideas ? Best Regards Not Saving Session - El Forum - 02-23-2014 [eluser]InsiteFX[/eluser] .application/config/autoload.php - autoload the session library under libraries. Not Saving Session - El Forum - 02-23-2014 [eluser]ricmen[/eluser] Hi InsiteFX, Sorry I didn't mentioned but I have the autoload.php with this libraries $autoload['libraries'] = array('database', 'form_validation','javascript','session'); The weird thing is when I enter to the page, I have this session, then I do another post to the same function and I have the session, but when I do another post to the same function with another action, the session is gone, I think that the session is saved and for some reason in the third post back this is cleared. any another idea? Best Regards Not Saving Session - El Forum - 02-23-2014 [eluser]InsiteFX[/eluser] Sounds like one of your methods is over writing your session item some place. Do a var_dump see where it is being over written. Not Saving Session - El Forum - 02-24-2014 [eluser]ricmen[/eluser] Yes You are right that was the problem, My code is something like this Code: $userInfo = $this->session->userdata("logged_in"); Now I think that I have the problem of save all this in a new object. do you know what would be the best approach for this? Best Regards Not Saving Session - El Forum - 02-24-2014 [eluser]InsiteFX[/eluser] You could save it into the database or use a registry class to save it. If you search the forums on my name yu will find a couple of them that we posted. Not Saving Session - El Forum - 02-25-2014 [eluser]noideawhattotypehere[/eluser] [quote author="ricmen" date="1393253707"]Yes You are right that was the problem, My code is something like this Code: $userInfo = $this->session->userdata("logged_in"); Now I think that I have the problem of save all this in a new object. do you know what would be the best approach for this? Best Regards [/quote] not really related to topic but: instead of doing x nested ifs, you can just do it like that Code: if ($this->input->post('newContract)) { |