Generally, the form processing could be split 3 steps:
- display form
- process data
- redirection to the results page (e.g. thank you page)
The redirection is done to avoid the form for being submitted again on refresh.
So, in your case, after the processing, you could redirect the user back to the same form again. If he refreshes the page, the form will not be submitted again, since the browser was redirected and the last action was a GET
request, not a POST
.
To do the actual redirecting in PHP, you could use the header
function:
if(isset($_POST)) {
...
// redirect back to the form
header("Location: form.php");
}