Welcome Guest, Not a member yet? Register   Sign In
Problems with $_SESSION
#1

[eluser]sherbo[/eluser]
I noticed that $_SESSION gets wiped out on each request. What's up with that?

When I added a

<?php
session_start();
?>

snippet to the top of each page, the session is empty on each page.

How do I correctly use the $_SESSION variable with CI?
#2

[eluser]Rick Jolly[/eluser]
Are you putting session_start(); in the view? It should be in the controller before any session operations.
#3

[eluser]sherbo[/eluser]
Ah yes, that was the problem. I had to put a <?php session_start(); ?> statement in each controller action.
#4

[eluser]ELRafael[/eluser]
use session library!!!
http://ellislab.com/codeigniter/user-gui...sions.html

:-P
#5

[eluser]Derek Allard[/eluser]
Yeah, the session library does offer all kinds of advantages for you, including security, flexibility and flashdata. Its pretty nice - give it a look Wink




Theme © iAndrew 2016 - Forum software by © MyBB