As was noted in one of the above comments, php is server side - it finishes all of its work before it ever gets to the user. I understand a possible need for a server-side popup in that the content may need to be customized on-the-fly with server content.
You'll need something on the client side to respond to a user (a client).
One way I do this is to create an empty <div> in the center of the screen. It has no content and is completely transparent in all ways. Inside of it you can create any type of HTML you wish. This is done with AJAX
If this or any of the other replies solves your problem, please use it to mark the question closed.