Welcome Guest, Not a member yet? Register   Sign In
Stop form re-submission on back ?
#1

[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?
#2

[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.
#3

[eluser]Phil Sturgeon[/eluser]
How about:

Code:
$this->output->set_header('Cache: No-cache');

Think that's right, off the top of my head. :-)
#4

[eluser]junaids[/eluser]
can u explain this
Code:
$this->output->set_header('Cache: No-cache');
and where should this line be placed in code?

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?
#5

[eluser]depthcharge[/eluser]
[quote author="junaids" date="1244342461"]can u explain this
Code:
$this->output->set_header('Cache: No-cache');
and where should this line be placed in code?

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




Theme © iAndrew 2016 - Forum software by © MyBB