Can't get $this->session->set_userdate to work |
[eluser]Volder[/eluser]
Hello, guys. I'm new on the forum and with codeigniter either. And I'm trying to set session data and use it on the different web-page. So I wrote a simple controller to show what an error I'm facing: Code: <?php If I erase redirect function call on pahe '/test' - I see that session variable val is defined with a value 100. So seems correct. But after redirect to a new page '/test/ttt' - I see a message on the screen: "On a new page: " and that's all. So seems that session data is not stored correctly. Why can this happen? Thanks.
[eluser]Randy Casburn[/eluser]
Hi Volder - First things first - You actually DO have a constructor in this controller right? I'm hoping you took it out for brevity?
[eluser]Sumon[/eluser]
I get everything perfect with your same code. and i hope you not miss to load session library for ttt() function. However you may try with Code: redirect('test/ttt' , 'refresh');
[eluser]Volder[/eluser]
[quote author="Randy Casburn" date="1221165000"]Hi Volder - First things first - You actually DO have a constructor in this controller right? I'm hoping you took it out for brevity?[/quote] no I don't have a constructor in this controller as it is not needed. Library 'session' is included into autoload configuration file. [quote author="Sumon" date="1221165000"]I get everything perfect with your same code.[/quote] Well, I checked on the other machine and it worked like a charm. So I make a conclusion - that something wrong on my PC. I checked in both FF3 and IE7 and in both it has not worked. While cookies are enabled. So do anybody can give a promt in which direction to investigate this problem?
[eluser]Skuja[/eluser]
There are other users that have experienced such problems with CI session. I would suggest you to try Native Session library. Although it is not a good solution, but it helped me. Also you could search in this forum about this, maybe someone has found the problem and better solution without a need to load external library.
[eluser]Randy Casburn[/eluser]
While not required, just for giggles, please add: Code: function Test() to your controller. Report the results. Randy
[eluser]Volder[/eluser]
[quote author="Randy Casburn" date="1221237191"]While not required, just for giggles, please add: Code: function Test() Randy[/quote] nope, it doesn't help. I've tried it after your first post. [quote author="Skuja" date="1221237191"]I would suggest you to try Native Session library.[/quote]I'm inclining to use OBSession. Still have not tried it - but going to write here whether it would help me. Thanks.
[eluser]Volder[/eluser]
tried both additional libraries: OBSession - have not helped. But with Native Session library I have solved my problem. Thanks.
[eluser]GSV Sleeper Service[/eluser]
stick with "native sessions" - I (and many others) have found CI Sessions to be unreliable when using IE. |
Welcome Guest, Not a member yet? Register Sign In |