Staying on the same page after the form was processed

If the form contains errors, you will probably display the same page again and highlight the errors. That’s good. But then if the form was successful and processed, such as creating a database record or charging a credit card, you need to redirect the user.

<?php
header("Location: http://example.com/user/add/success");
?>

Redirecting the user lets you prevent “replaying” the action.

https://afilina.com/common-php-mistakes