Passing javascript variable to php file October 22, 2022 by Tarik Billa You could use cookies – set in JS, and read from PHP. Another way can be using an AJAX request to get the variable value.