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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.