Posted by Avi in Programming on May 7th, 2009
A common idiom in web development is that a form is submitted via POST, and then a redirect is done to a success page. The reason for this is that if we left the result of the submission to return HTML to the browser, we would run into the infamous and confusing message “To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier.” (At least the way firefox tells you). This has become none as the POST/REDIRECT/GET pattern.
The problem becomes that, because of the stateless nature of HTTP, this second request has absolutely no connection to the previous request. If we just wanted to display a thank you page, or a success page, this would not be much of a problem. But what if we wanted to display the same form again, and display a success message on top when its submitted?
One way of doing this, which is the way Expression Engine does it, is to pass in a parameter in the query string, like ?success=1. The problem with this is that now if somebody refreshes the page, they’ll see the same message. Not the biggest deal in the world, but can we do better?
Read the rest of this entry »
add-on, Expression Engine, extension, Flash Message, Flash Messenger, pattern, plugin, sessions
Fusion theme by digitalnature | powered by WordPress
Entries (RSS) and Comments (RSS) ^