Redirect with POST parameters
I came across a requirement recently where I wanted to redirect a user to a new page and pass along a few parameters. The Zend Framework redirector helper gotoSimple() function takes an array of parameters as the 4th argument, so this seemed fairly easy at first. The parameters however are simply appended to the end of the redirect URL. I didn't want this to happen as I was redirecting users to a dynamic error page. So, naively, I stared looking for a way to force the redirect to use POST parameters...
This of course is not possible if you think about how a redirect works. The Zend gotoSimple function simply sets the HTTP location header to the specified action-controller URL, and appends the parameters to the URL if supplied. This header is sent to the client as a simple string. When a client browser encounters the location header in a response, it performs a GET on the location URL. There is no way to tell the client to perform a POST instead (the URL is just a simple query string anyway).
The simple workaround to this is to use session variables. That is, before sending the redirect headers, stick all your POST parameters in a session token, then on the redirect page logic, check the session and retrieve the parameters! This way you're still doing a redirect (and the client is still accessing your page via GET), but the parameters never leave the server.