I have a form that needs to be able to take data on each load so I can't use any session or unique tokens for this I want the user to be able to double submit the same form if he needs to but I don't want an old entry to be stored if the user hits "back" and then "forward" on the browser. The script is in PHP but JavaScript solutions are as good as serverside solutions.
EDIT: The form has action="" so the user will be redirected to the same page that is why it is sensible at back forward actions. For example:
we have a form for an invoice so you add Item 1 you submit, then you add Item 2 submit then you add Item 1 again so the quantity is incremented and so on, you don't know how many Itmes an invoice has... and you have to stay on the same form page.
Asked
Active
Viewed 343 times
1

jnhghy - Alexandru Jantea
- 2,701
- 26
- 36
-
Possible duplicate: http://stackoverflow.com/questions/4614052/how-to-prevent-multiple-form-submission-on-multiple-clicks-in-php/4614123#4614123 – Walialu Mar 14 '13 at 15:51
-
1I'm confused - Do you mean you want to make sure the form is clean each time its loaded? – apelsinapa Mar 14 '13 at 15:52
-
You need to use single use tokens to prevent form resubmission otherwise you cannot tell the difference between a back then forward, a forward then back a refresh etc – Anigel Mar 14 '13 at 16:41