I'm searching for the best way to supply the page after a redirect with a success messages. I think redirecting after a form was submitted is the best way to prevent a form to be submitted multiple times.
The following possibilites are some that I got in my mind. What do you think is the best of them and why or do you have other possibilities?
- Save the message in the session and read from there on the target page
- Supply the new page with some GET parameters like
header('Location: index.php?success='.urlencode($message));
-
Supply more than the
Location
header and read them on the target page like thisheader('Location: index.php'); header('X-Success-Message: ' . urlencode($message));