I have a controller which displays and processes postback for a form. The controller redirects to another page once the form has been successfully validated and the data has been processed accordingly.
Redirection is completed with something to the equivalent of:
@header('Status: 303 See other');
@header('Location: ' . $redirect_uri);
What is the most reliable way for the controller to provide a message that is to be displayed on the new page? Is there a standard practice for this?
i.e. "Your account was successfully updated."
My thought is to place dynamically generated messages into a session variable, and to indicate a predefined message with a unique ID in the URI itself:
$_SESSION['previous-response-msg'] = "Account of '$user_name' was updated.";
or
$redirect_uri = 'http://example.com/other-page?msg=42';