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.
We can simply store flashdata as shown below.
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.