| 9:42 pm on Jul 6, 2013 (gmt 0)|
if you are properly redirecting to a thank you page there shouldn't be any way for a refresh of the thank you page to resend the POST request.
| 5:54 pm on Jul 7, 2013 (gmt 0)|
I'll try to elaborate a bit:
The correct way:
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].
| 11:26 am on Jul 8, 2013 (gmt 0)|
This is an issue:
If the user presses refresh all they do is reload the thank you page;
thank you page should UNset session variables and mail function should not be executed.
| 2:46 pm on Jul 8, 2013 (gmt 0)|
The redirect issued by the script getting the input from the form makes sure the thank you page doesn't do any processing. SO you can leave session etc. all intact.
Just DO NOT output the thank you from the script that processes the form input. A redirect inbetween these is essential.
| 1:21 pm on Jul 9, 2013 (gmt 0)|
Just DO NOT output the thank you from the script that processes the form input.
I'm new to this. How to DO NOT output the thank you.
| 1:50 pm on Jul 9, 2013 (gmt 0)|
After you finish sending email from your php script just redirect the page to thankyou.htm page.
Redirection code in php is as below.
So even if user refreshes the page it will be thankyou.htm and not your php page.