Forum Moderators: coopster
Basically I have a system that has a users account and they can purchase items off me.
Now, the system does what its supposed to do, but when I click back or refresh, the browser resends the post data, thus creating another transaction.
My developer has tried to stop this from happening by putting timestamps on the transactions but the weird thing is when you click back or refresh the browser basically reloads the page with a fresh copy of data and resends to form.
I need to find a way to stop the back button and refresh buttons from re requesting the data. As im finding major database errors as this is purchasing some items with no values…..
Can someone please help,
Cheers.
Steve.
I am not a professional but you could use session:
1/ Load the "Purchase Order Number" in a session after submission
2/ Check before submitting data if LPO No is found in the session.
3/ If yes, then it means that the LPO has already been sent (show message "Your order has already been sent blah"
4/ If not, process the order.
Note: You could do exactly the same way using databases. Add LPO No in user database when order is sent and check before processing data if LPO No is found in user database.
My 2cents!
It is usually a logic flaw, built right in.
yes browsers will all repost data, it shouldn't make the row in the db ghet rewritten.
1. this could be caused by forms posting to themselves.
processing scripts should have no output therefore you can never go back to them and have them repost.
2. multi stepped processes
If the user needs to go through multiple steps (forms), and dat needs to be carried through them, then the id/timestamp needs to be created before anything is posted at the very first step.
there are other possible issues as well but these are the most common.