An efficient way to avoid multiple unnecessary requests followed is to use a captcha service, so the request is only made once and after the user sends the captcha, this avoids multiple requests and also the problem of possible spam.
However captcha ends up leaving the sending of the form slower for the user (which is unpleasant), so one solution that comes to mind is the following:
You can store in a Session the exact time the last request was made, and set a minimum time limit to perform a new action.
You can also disable the upload button with the attribute disabled
using javascript, this will cause a more pleasant effect although it may be the case that the user has javascript disabled.
The script below can help:
$('form').on('submit', function() {
$(this).find('[type="submit"]').attr('disabled', 'disabled');
});
yes, you can just lock the button right after the user clicks on it, block that I speak is give a
disable
– Silvio Andorinha
Although this is about email, and the other about inserting DB, the vast majority of the answers of the other one has solution that serves for any repeated sending, in particular the redirect (and Phpmailer has no relation to the problem, despite being in the tags).
– Bacco