[eluser]jakeone[/eluser]
I normally use a hidden token in my forms and match this to a session variable to prevent duplicate submissions.
However, it does not appear to work for me in CI.
I submit a form with deliberate errors. Errors are flagged. I fix errors and submit successfully. To test, I click "Back" and see the form with errors again. I fix errors again and submit. At this point, I expect my code to pick up the fact that it's a duplicate i.e.
Code:
$this->input->post('token') == $this->session->userdata('token')
etc. However, when I look at the page source, a new token has been generated even though I'm looking at a cached page (or I thought I was)
I can only assume that CI is running Form Validation when I click Back (e.g. the browser asks me if I want to resend the data) and this creates a new token which makes my code think it's a fresh form. Am I imagining this?
What are you guys using to prevent repeat submissions?