Pop up blocker issue opening a new frame

My PHP inserts a record in a database table which contains a GUID value. It then needs to call another website, for sake of example http://othersite.com?g=guidvalue

I tried creating a PHP function that inserts the record then uses the header function to direct to that site but could not find a way to tell that function it needs to open in a new frame. Online suggestions said to call a javascript function to use that languages commands to open a new frame which works but browser pop-up blockers are now stopping the page from displaying without user action to allow.

I need to ensure the operation of inserting the record happens before any new frame opens in the browser otherwise that site will fail validation since it uses a webservice to test for a record in the database having the guid value (and not too much time has passed since the record was inserted).

Any suggestions on how to wire both events to a button click and dynamically build out the link that will open in a new browser window in that the needed order?

Thanks!

HI,
Backend and Frontend are two different things:
Backend, is the server side.
Frontend is the client side.

If you want to be sure that a record is inserted before a redirect and SHOULD be in a new tab, you cannot do it in PHP because PHP cannot speak with the creation of the tab of the browser.
You can:
-From the frontend call with Ajax a backend page that:
-Is creating the DB record
-Is returning a status done with the GUID value (as a Json object)

Once the return in Ajax is done (is an ASYNC call, be careful to use .then() method and the .catch(err)) you can open a new browser tab with the url to redirect having a GUID value retrieved from the Ajax callback.