Bladephp: Now with 8+ codeigniter, php, and laravel project 8+ php project From $37/Month From Rs. 2499/Month

How to create flash messages in Codeigniter

by
Category:codeigniter
codeigniter
How to create flash messages in Codeigniter

Let me explain about the CodeIgniter session flash message. It’s a temporarily stored value. This coding used to set success message and failure message through your controller. Let start to learn how to create CodeIgniter session flash message.

Flash session set code work with your controller functions. Session response code displays your flash view files. Generally, we will success message after submitting the form try to use session message.

Set flash data in controller

$this->session->set_flashdata('SUCCESSMSG', "Record Added Successfully!!");

Read flash data

<?php if ($this->session->flashdata('SUCCESSMSG')) { ?>
<div role="alert" class="alert alert-success">
   <button data-dismiss="alert" class="close" type="button">
	   <span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
   <strong>Well done!</strong>
   <?= $this->session->flashdata('SUCCESSMSG') ?>
</div>
<?php } ?>

0 Comments


Html code work in comment box


Related Post