I have a hidden parameter called 'act' that should pass one of the values 'load', 'save' on pressing the submit button.
The problem is when pressing on the F5 (refresh) button after pressing the submit button because the url already contain '&act=save' so prssing on F5 actually pass (to cgi) the 'save' value again (and it perform the save action again even I didn't press on the submit button.
The queston is how can I prevent sending the '&act=save' on pressing the reffresh button?
Thanks
Thanks you all but the submit button is a 'save' button - means I wish to leave the user the abbility to perfrom addiitonal save so don't wany to leave the page. From this reason, I don't think that the session may help to distinguish between the second save or the first refresh.
The core problem here is that you are using GET when you should be using POST. The HTTP specification says:
In particular, the convention has been established that the GET and HEAD methods SHOULD NOT have the significance of taking an action other than retrieval.
If you were using POST then the browser would, at least, warn you about resubmitting a form.
To avoid even that, use the POST-Redirect-GET pattern.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With