Form resubmission protection.

Well, that’s actually the problem. We need to guard against resubmitting the form, given the fact that the form is handled by a separate class. Those. the structure of the script is as follows (in general terms):

<>
  ( == true) => :: (   )
</>
<>

I.e. the form and the handler are on the same page, and the data gets into the database through the method of the plug-in class.

P.S. Sessions, cookies do not offer. From behind

Cannot modify header information – headers already sent by…

Redirects too, because a message with the result of processing the form should be visible


Answer 1, authority 100%

What if we add a hidden element to the form and record the submission? Is it possible to resubmit when updating (reopening) the page? Also, see if it’s possible to implement it through an additional static property (field) of the class.


Answer 2, authority 67%

You need to submit the form to the processing page, process it, and then redirect it to the results page. Accordingly, nothing should be displayed on the processing page, only headings should be thrown.

Or else, form processing should happen on the same page, but before anything is rendered. In case of submitting a form, you can redirect to the same page with &success=trueand a random parameter (to avoid caching).


Answer 3, authority 33%

And what if so – make a table and store there a queue of, say, the last 10 sql queries.


Answer 4, authority 33%

<input type="hidden" name="check" value="<?php echo time();?>" />
if(empty($_POST['check'])) {
  echo '';
}
if(isset($_POST['check'])) {
//  
unset $_POST['check'];
}