Just to get the terms clear:
JavaScript variables is probably the wrong term - unless you really mean javascript calculated values.
To transfer these values to a PHP page some kind transport via the HTTP protocol is needed, such as a form, or GET parameters on the URL string. POST (with forms) is preferable. The values have to be set to a form field so they will be available in PHP.
Cookies are ok, but what if the visitor has cookies turned off?