0

i would want to know if is it possible to clear the form data through php.

i want to restrict the user from resubmitting the form even if the user click back button in the browser.

thank you..

Ibrahim Azhar Armar
  • 25,288
  • 35
  • 131
  • 207

2 Answers2

2

You want a "nonce", a unique value that is generated when the form is requested, then checked and invalidated when the form is submitted so that it can not be resubmitted.

There is already a question which discusses the FullThrottle nonce library for PHP, and another question about preventing the double-insert that typically happens when forms are submitted twice.

You should also be submitting the form via POST, and then redirecting the browser so that it requests the results via GET.

Community
  • 1
  • 1
user229044
  • 232,980
  • 40
  • 330
  • 338
  • Just to note that the post in question is highly critical of the full throttle nonce library. I use the OWASP PHP library (http://code.google.com/p/owasp-esapi-php/) for a few things, and it also has random number generators which can be used for nonces. – El Yobo Dec 05 '10 at 07:33
0

There is no way to clear the form using PHP if the user uses the back button, though meagar's answer may provide your solution.

Toby Allen
  • 10,997
  • 11
  • 73
  • 124