I think it's easier to have your PHP code write the popup code.
For example, in your PHP script, process the data, then do something like:
<? echo "<script>window.open(...);</script> ?>
And have the open function open another PHP page which you can pass the required values to. That's one way.
You could also include the JS script file at the top of the PHP page which has all the window opening code in it, then use the above method similarly:
<? echo "<script src='script.js'></script> ?>