How to set Fleshdata in Codeigniter?
1.What is Fleshdata?
- Fleshdata is session data that will only be available for the next request and after use, it will be cleared automatically.
2.Create a controller page and save welcome.php:-
<?php
class Welcome extends CI_Controller
{
public add_user()
{
$this->session->set_fleshdata('message','Added Successfully');
$this->load->view('index');
}
}
?>
3.Create A View page and save index.php:-
<html>
<body>
<?php if($this->session->fleshdata('message')){?>
<div class="alert alert-success">
<?php echo $this->session->fleshdata('message');
?>
</div>
<?php } ?>
</body>
</html>
Tagged: