I would like to store the variable in the session currently i am tryin like this but not working.
In Controller
You don't have to set the session the PHP way.
CodeIgnter has its on Session Class
Load the session library:
$this->load->library('session');
To set session data:
$this->session->set_userdata('some_name', 'some_value');
To retrieve session data:
$this->session->userdata('some_name');
To remove session data:
$this->session->unset_userdata('some_name');