Back to the top
One of the sources of this problem is closely related to the Passing a Javascript variable to PHP problem (so you may want to look at that post as well); a confusion between client and server. It's sometimes made worse by a confusion between http and HTML.
http stands for "hypertext transport protcol", but to be blunt, the only bit about it that's "hypertext" is the concept of the URL. It defines a method for asking for and getting stuff that allows the receiver to outline what sort of stuff it would prefer and know what sort of stuff it's getting. In other words it is a set of rules for moving stuff from one place to another - "transport protocol" for short.
HTML is a language for the marking up of web pages (hence, "hypertext markup language". When http was designed in the very early 1990s, it was the only thing that was being transported, which is why they both start with "ht". But that was a very long time ago, and even then it was always intended that it would be able to carry any other resources as well.
If you want a very rough analogy, http is like a set of road markings and rules about what they mean and what you're supposed to do when you're driving; http requests and responses are the vehicles that use the roads; and HTML is freight and passengers being carried by those vehicles.
As a rule of thumb, if you're asking the "browser" (a particular kind of http client) to do something (open a window, close a window, update a menu, etc.) then chances are good that what you're asking for is not something PHP can do. If, on the other hand, you're wanting to do something that involves interacting with a database or some other resource that's available to the server, then chances are good that it is a PHP issue. And if it's both, then you can have a squizz at the Passing a Javascript variable to PHP post for some ideas; if you need help telling the two ends of the job apart, we can help you with that.
PHP runs on the server and uses http - not HTML - to communicate with the client. If you want the client to do anything, you have to instruct the client to do it. That means you have to send the client instructions that it then has to follow to get it to do what you want it to do. PHP can't make the client open a new window when a button is pressed, because PHP can't make the client do anything. What PHP can do is send the client instructions (written in Javascript) in the button's onClick= handler instructing it to open the window; and only if and when the client chooses to run those instructions will the window open. (Remember, most http clients don't support Javascript at all; in fact, most don't even know what a "window" is and can't open any - so what would you expect to happen if PHP could tell a client to "open a window"?).
So the client may or may not follow your instructions (and it certainly won't if you try to run the instructions on the server!). That is the nature of the beast; the client is not under your control. You can't even say for sure what sort of program the client is (you can only go by what the client tells you, and you can't force it to be honest).