Skip to content Skip to sidebar Skip to footer

Using A Javascript Variable To Set Php Variable

Possible Duplicate: Get variable from PHP to JavaScript Access a JavaScript variable from PHP I currently have this line of code: displaystatus('CALLER IS: '+inCallingNum); whi

Solution 1:

Php is server-side code, javascript is client-side code. It is not possibile to do what you're asking, you have to set $user_number with a call to the server.

When you are working with javascript you have already had the response from the server, so you are working with the result of the server-side actions, you cannot change the source from the result.

Solution 2:

Since JS is run after Apache processes the PHP page, this is not possible.

Solution 3:

you can try this,

<?php$user_number = inCallingNum ?>

where inCallingNum is your javascript variable.

Post a Comment for "Using A Javascript Variable To Set Php Variable"