CodeIgniter Forums

Full Version: getFlashdata is not clearing the message
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am using codeigniter4 and uses the following code

In the controller -

$this->session->setFlashdata('success','Your  Data is saved'); 
[font=Droid Sans Mono]return view('dashboard');[/font]

[font=Droid Sans Mono]In the View [/font]
[font=Droid Sans Mono][font=Droid Sans Mono]               <?php if (session()->get('success')): ?>
                  <div class="alert alert-success" role="alert">
                    <?= session()->getFlashdata('success'); ?>
                  </div>
                    <?php endif; ?>
                  </div>   
[/font]
[/font]



As per  code igniter 4 , this flashdata should clear . But flashdata shows in the second page also . Then it clears on the third page .
If you echo the view instead of returning the view doe's it still do it?
(11-13-2020, 01:09 AM)InsiteFX Wrote: [ -> ]If you echo the view instead of returning the view doe's it still do it?

it is the same issue with the echo view
Echo view also does the same issue