Jump to content

restrict number of submissions on form


dannyd

Recommended Posts

You could simply populate a hidden field in the form when the page loads with a unique value (i.e. datatime+rand() number). Then when processing that page first check if any existing records have that value. If so, do not add the duplicate entry. If not, store the new record, including the unique value.

What if it is just a form used to send email and there is no database interaction?

 

Fine, make me think a little harder. Here's a probably better approach.

 

When the form is submitted to the processing page, go through the normal validation procedures and if everything passes take whatever action is required (save data to DB, send email, etc.). THEN, do a header redirect to a confirmation page (e.g. "Thank you for your submission"). Then if the user refreshes the page they will just keep seing the confirmation page and the submission won't be processed again.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.