Try this:
Change in your "handle inser...":
header('Location: ' . $_SERVER['HTTP_REFERER'] . '?redirect');
Add in your "insert record..."
if(isset($_GET["redirect"]) { header ("location: page1.html"); }
Explanation:
The first one will send a parameter to the "insert record page then the insert record page will check if it has a parameter named "redirect" then if it will be having it will redirect it to the page1!
I would recommend you creating a seprate page for redirection where you send it a URL as a parameter and it redirects you to that particular URL. That's what I do. Meanwhile on that page I also do some validation. :)
According to @War10ck and PHP Docs:
This is set by the user agent. Not all user agents will set this, and
some provide the ability to modify HTTP_REFERER as a feature. In
short, it cannot really be trusted.
For that this question may help. It suggests keeping the record our selves.
Resource: PHP Docs