I am doing web development.
I have a page to do with credit card, which when user click \"refresh\" or \"Back\", the transaction will be performed one more time, wh
I found the above Post/Redirect/Get explanations a little ambiguous
Here's what I followed and hopefully it helps someone in the future
http://wordsideasandthings.blogspot.ca/2013/04/post-redirect-get-pattern-in-php.html
Essentially the process based on the above solution is:
Redirect with something like:
header("HTTP/1.1 303 See Other");
header("Location: http://$_SERVER[HTTP_HOST]/yourfilehere.php");
die();
The header redirect will initiate a GET
request on "yourfilehere.php", because a redirect is simply that, a "request" to fetch data FROM the server, NOT a POST
which submits data TO the server. Thus, the redirect/GET
prevents any further DB/payments processing occurring after a refresh. The 301
error status will help with back button pressing.
Helpful Reading: