as per title above, when I trigger the controller with a hyperlink, it does runs the controller function but I couldn’t get the value of SESSION after redirect from controller. The code is as follows…
function langpref($lang){
$this->load->helper('url');
redirect(ABSOLUTE_PATH, 'location');
$this->session->set_userdata('cur_lang', 'xxx');
}
*Note: ABSOLUTE_PATH is a constant of the hyperlink, and I already load the SESSION library in the autoload file.
In my view file, I written the code as follows…
<?php echo $this->session->userdata('cur_lang');?>
and it doesn’t print out the SESSION value.
First Approach: You cannot access session variables like that
Second Approach: Another way you can do this is pass the session data to the view
On your controller
On your view