Welcome Guest, Not a member yet? Register   Sign In
Trigger update message from method?
#1

[eluser]rich.a.coy[/eluser]
I'm new to MVC. What's the best way to trigger a "Your Information Has Been updated" type message from a controller back to a view? I'm redirecting back to the same page so I can't just hard code a message onto the page.

Thanks.
#2

[eluser]Twisted1919[/eluser]
use sessions to store the message , then in the view check the session then flush it .
#3

[eluser]rich.a.coy[/eluser]
Thanks for your quick reply.

So use something like set_userdata($message) in the controller and unset_userdata($message) in the view after the message is displayed?
#4

[eluser]Twisted1919[/eluser]
I would go with session flashdata : http://ellislab.com/codeigniter/user-gui...sions.html [ see Flashdata section ]
CodeIgniter supports "flashdata", or session data that will only be available for the next server request, and are then automatically cleared. These can be very useful, and are typically used for informational or status messages (for example: "record 2 deleted").
#5

[eluser]rich.a.coy[/eluser]
Awesome. Thanks for the help!




Theme © iAndrew 2016 - Forum software by © MyBB