Any web developer who has been in the craft for more than a couple of days realizes how often forms are used in web development. Well... Where forms are used, form methods are used, and one of the crazily irritating problems with forms using a "POST" method is the fact that when the "back" button is pressed after leaving the initial posted page, a pop-up shows its nasty face and asks a question, to which most people don't know the answer. Luckily, in my experience, most people just click "Ok".
So... What to do about this? Are we all doomed to forever forget the awesome power of posting forms due to a silly quirk such as this!??! I say unto you NO!!!
, a good friend of mine, came up with a brilliant solution to this pesky posting problem perpetuated by problematic programming! What is this solution?
Yes... The best way to deal with this problem is both simple and brilliant:
Simply catch the entire posted form held within the $_POST variable and assign it to a session ($_SESSION) variable.
After doing that, simply do a soft-redirect using the "header" command.
This solution assumes you're programming in PHP, although I'm quite certain it can be done in other languages as well.
Anyway... After doing that, BOOM! Your posted information causing the pop-up warning to appear disappears into a nice safe session variable to be held as long as is necessary.
Something as simple as the following should do the trick quite nicely in most scenarios:
$_SESSION["posted_form"] = $_POST;
Or something similar.
Anyway... Kudos to Steve and thanks for sharing the knowledge! It's worked fantastically for me since ya told me about it.