As ingresman said, no.
In order to set a session variable there must be an exchange of data between the client and server, the form needs to be submitted and some PHP executed.
You can construct a combination of client and server side code that achieves what you want:
1. Make the button "open" a new window which is the PHP script that infuses the session variable into the server's session tracking.
2. The PHP script issues a client side scriptlet that closes the new window.
That's kind of crude, since there will be the new window for a short time, but you could set a text to it befor it closes...
However, the separation between server and client side technology holds always true.