Well, what you want to do is impossible the way you want it. But there is one trick.
Once you've got you Javascript variable, you may create invisible form with input which has name of your PHP-variable. This form should be submitted automatically.
So, if you have JS variable called js_var and PHP-variable called php_var, you will neeed:
<FORM ACTION="php_script.php3" METHOD="POST" NAME="frm">
<INPUT TYPE="HIDDEN" NAME="php_var" VALUE="">
</FORM>
<SCRIPT LANGUAGE="JavaScript">
document.frm.php_var.value=js_var;
document.frm.submit();
</SCRIPT>
Like this, I suppose. I would have done it this way.