Javascript and PHP ARE NOT THE SAME. You're thinking, duh! obviously but I mean Javascript is a "client side" technology while PHP is a "server side" technology.Your Javascript can read from PHP variables only because the .php page is being processes on the server "first" and the output returned. Hence any variables will be output into the JS.However, the reverse is NOT true. Your Javascript does not have access to any PHP information as it resides on the server. The only way you can make JS variables accessible to PHP is to make POST or GET back to the server (call the .php again) with the required variables+values.