Flashdata not getting cleared in Codeigniter
your code in controller is right
//In the manage of controller$this->session->set_flashdata('message', "Record updated successfully.");redirect('controller_name/function_name','refresh');
now in view use like this
if($this->session->flashdata('message')){echo $this->session->flashdata('message');}
hope it will work
You must redirect the page somewhere after $this->session->set_flash('item','value');
Example:
if ($this->form_validation->run() == FALSE){ $this->session->set_flashdata('error',validation_errors()); redirect(base_url().'user/login');}else{ $this->session->set_flashdata('success','Thank you'); redirect(base_url().'user/login');}
Usually developer make a mistake when they submit data to same page. They set flash data but forget to redirect.