You write that you can not pass to php from javascript because it is a server site language.
I can't see any reason why this should not be possible.
You just can't do it on the same page, but if you make a javascript print out content to a page, in such a way that you create a link to a php page, and add a variable at the end of the link, you should in principle be able to send the value of a javascript variable to that php page.
I havn't tried it yet, but I will see if I can create an example.
Jesper.