Seth M. answered 02/07/20
Decades of Experience with PHP, HTML, SQL, CSS, and Javascript
Your entire question didn't get posted, but the simple way to pass a variable from PHP to JS is to have PHP echo a JS variable declaration when generating the HTML stream. For example, if I want JS to create a variable called "myJSVar" and assign a value of 3, then the PHP code might be something like:
This should produce this HTML: