Ibrahim Azhar Armar
Ibrahim Azhar Armar

Reputation: 25745

is there a way to clear the form data in php?

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

Upvotes: 0

Views: 174

Answers (2)

Toby Allen
Toby Allen

Reputation: 11213

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.

Upvotes: 0

user229044
user229044

Reputation: 239311

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.

Upvotes: 2

Related Questions