CodeIgniter, Tutorials

How to use Flashdata in CodeIgniter?

12 February 2019

we need to store some data for one time and after that we want to remove that. we can achieve this type of functionality using Flashdata in CodeIgniter. Flashdata will only be available until the next request, and it will get deleted automatically.

Add Flashdata

We can simply store flashdata as shown below.

  • mark_as_flash() function takes only one argument of the value to be stored. We can also pass an array to store multiple values.
  • set_flashdata() function takes two arguments, name and value, as shown below. We can also pass an array.

Retrieve Flashdata

Flashdata can be retrieved using the flashdata() function which takes one argument of the item to be fetched as shown below. flashdata() function makes sure that you are getting only flash data and not any other data.


Leave a Comments