CodeIgniter Forums

Full Version: Multiple form submissions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
I am looking for a way to intelligently handle what happens when a user repeatedly pounds on a form's submit button. Is there anything built into CI that can help with this?

I've been considering seeding the form with a secret code that's also stored in the session. When the form gets submitted with a code that matches the code that's in the session, processing is done and the session code is cleared, which causes extra submits to be ignored. The problem with this is that if the user then goes back to the original form via the back button, retrieving the page from the cache, complete with the orignal secret code, and tries to submit a new form, perhaps with different info, the submission will be ignored.

I've also considered javascript solutions, such as disabling the submit button, but there's no guarantee the user will have javascript enabled and server-side logic would be required anyhow.

Any thoughts would be greatly appreciated!

El Forum

[eluser]Rick Jolly[/eluser]
You might be interested in this thread, which shows how to add headers so that browsers won't cache pages:
http://ellislab.com/forums/viewthread/51313/#250141