When there is mail PHP function and it is validated with redirection to Thank you page, I like to know how to avoid when sending contact forms. When users RELOAD page at Thank you page it will send as many emails (none content) as it is reloaded.
How to avoid this in the correct way with PHP script.
You have a form sent to the browser in HTML - PHP script or static or... doesn't matter.
Inside the form there's an action="...." that points to a PHP script on your server. When the user submits the form, that script will receive a GET or POST request and the script will execute on the server.
The script upon success does what it needs to do and emits a 302 redirect to the browser, pointing to another URL that shows the thank you page (can be another PHP script, static content, ... whatever).
The browser contacts the server for the thank you page.
If the user presses refresh all they do is reload the thank you page; if the user goes back they end up on the form again, which they could resubmit.
If you want to avoid that last, you have a bit of work as you now need to know to keep track of state and have the server know who already submitted what form etc. [Multiple techniques exist. But I doubt it's your problem, nor is it a problem with contact forms in general - yet].