Redirect - pass message to next page |
Not sure if this is in the right place....
I need to perform a redirect after a database action (delete). I have added the folowing line: return redirect()->to('/evenementen/' . url_title($evenement['evenement_naam'], '-', TRUE)); On evenementen/evenement_name I need a specific message to be shown ("The event was succesfully removed"). Is there a specific CI4 way to do this nicely of should I just add a query to the url? (?m=the_message) I'm pretty new to CI in general, coming from php without any frameworks, so forgive me if this is a "stupid" question ;-)
Try adding "with('message')" like this:
PHP Code: return redirect() Then in your view, you can output the message like this: PHP Code: <?php if (session('message') !== null) : ?>
Thanks! This worked perfectly. And with a little tweaking I even managed to pas along different types of messages (errors and success messages)
|
Welcome Guest, Not a member yet? Register Sign In |