I am new to the codeigniter framework, i am using flash messages it's displaying correclty but even after redirecting to another page still the same flash message is displaying for this issue i was trying to fix by following this accepted answer but still i am facing with this issue only, can you please help me did i miss anything..?
controller.php
$this->session->set_flashdata('msg','<p style="color:green;margin-left:40%;font-size:15px;">Book Added Successfully</p>');
redirect('/books');
view.php
<?php echo $this->session->flashdata('msg'); unset($_SESSION['msg']);?>
My Answer:
load->library('session');
$this->session->set_flashdata('message', 'This is a flash message');
redirect('another_page');
// In the view file
echo $this->session->flashdata('message');
// After trying to unset the flash message
$this->session->unset_flashdata('message');
Rate this post
3 of 5 based on 1149 votesComments