I am looking for a way to stop inserting or sending data in the database when refreshing the page.
here is my code:
user_details_page.php
<
Once an insert or update is done in your code you always need to redirect to another page.
See here on how to do that: How to make a redirect in PHP?
(You want to use a PHP redirect, not a Javascript or HTML one, because you obviously really need this to work.)
The confirm page should be what you redirect to after the update, not what does the insert.