Solving The HTTP Double-Post Dilema
Everyone who has done any sort of web development, and made use of the HTTP POST has run into this problem. If you haven’t, are you sure you are doing proper QA?
Basically, the problem comes from having the POST information still resident after an HTTP POST. If the user were to refresh their browser, that POST information will be resent, resulting in a double post. There are many ways to solve this problem, but the one I will outline (in PHP) seemed like the best for my situation.
Let us assume we have a text input and a button and that our form.php file will process our form as well as present it to the user (yes, I know this isn’t a good idea, but it is just an example).
(more…)