Stop form re-submission on back ? |
[eluser]PHP Creative[/eluser]
Is there anyway to stop form re-submission in CI? For example when a user submits the form it redirects to another page (which stops refresh submission) but if they were to click back they could easy re-submit the form. Can you clear the data in the form after submit?
[eluser]mddd[/eluser]
You could build a random number into the form in a hidden input field. On form submission, check if the random number is the same as was recently submitted. If so, just disregard the submission.
[eluser]Phil Sturgeon[/eluser]
How about: Code: $this->output->set_header('Cache: No-cache'); Think that's right, off the top of my head. :-)
[eluser]junaids[/eluser]
can u explain this Code: $this->output->set_header('Cache: No-cache'); plus i have a different question... when a user is logs in( submits username, password) to application...he is directed to his homepage. if he refreshes the page...username password is resubmitted and again authenticated..how can i stop this?
[eluser]depthcharge[/eluser]
[quote author="junaids" date="1244342461"]can u explain this Code: $this->output->set_header('Cache: No-cache'); plus i have a different question... when a user is logs in( submits username, password) to application...he is directed to his homepage. if he refreshes the page...username password is resubmitted and again authenticated..how can i stop this?[/quote] When log in is successful do a re-direct to the users page, then if he refreshes he is refreshing the user page, not the form submit. redirect is explained here |
Welcome Guest, Not a member yet? Register Sign In |