I'm getting a undefined index error when checking if a session exists. The error only occurs when a session does not exist.
Controller where the session is created:
$data = array(
'email' => $this->input->post('email'),
'is_logged_in' => TRUE
);
$this->session->set_userdata($data);
redirect('site/index');
Controller where the check takes place:
$is_logged_in = $this->session->userdata['is_logged_in']; // error occurs here
if(!isset($is_logged_in) || $is_logged_in !== TRUE)
{
$data['main_content'] = 'login_form';
$this->load->view('includes/template', $data);
}
I've made sure the session library is loaded.