Not able get flashdata in CodeIgniter
I am wondering why not able to get flashdata in codeigniter. Here Some point we have to aware before setting flashdata in codeigniter.
As of you know session in codeingiter handled by two way, one is file and other one is database. So some times database session causes problems. SO we need to set.
1 |
1 . $config[‘sess_use_database’] = FALSE |
2 . Flashdata work in only redirect the function in controller in load view. For example
1 2 3 |
$this->session->set_flashdata('message', 'This is an informational message.'); redirect('/profile'); This case flashdata will work |
1 2 3 4 |
//Load view $this->session->set_flashdata('message', 'This is an informational message.'); this->load->view('user'); //This case flashdata does not work. |
3. Name of message should exactly match with setting in controller and populate in view page.
4. Check That should not written before too much redirect function. In that case you have to write
1 |
$this->session->keep_flashdata('message'); |