Suppose there is a web form in your PHP page and it posts values by POST method to same page. Then you get values from $_POST and insert them to Mysql table. It is OK.
But when I want to feedback (success or error), I get confused.
I use bootstrap toast messages. For example, when input values are not regular or insert query fails, toast message says: Error: New record fails!
When insert query succeeds, toast message should say: Success!: New Record Added!
But visitor also can refresh the page, it means double time same code and double insert
To prevent resubmitting the page, I use header code. After successfull insert query, I redirect the page forexample like this:
header("location: page.php?NewRecord=Ok");
So I check by PHP code; is there any GET value in URL, and if there is "NewRecord=Ok", toast message says: Success!: New Record Added!
But, when visitor referesh the page, the URL does not change. It is still "page.php?NewRecord=Ok".
Thus, the visitor can still see same toast message by refreshing same page.
I think you understand me. What do you advice me?