Sending UI Messages in PHP

I am using sessions to save UI messages that can be shown to the user after an action has been formed (ie: logging in).

My initial problem was that the message persisted, while attempts to unset the session message didn’t allow for any messages to be shown.

Here’s how I solved the problem:

First save the messages from the session, then you can delete them out of the session so they don’t persist past the one request.

Here is how I set the proper success or error message in the login function: