I am trying to get a variable from javascript into php. i know that you can do that with a form, and refresh the entire page or load another page, but i do not want to do that. here is my code that i have been trying to work with....
function nextplayer() {
<? if($_GET['DoThePhp'] == '1'){$result = mysql_query($sqls);} ?>
nextp = nextp + 1;
if (nextp == <? echo $numberresult + 1; ?>){ nextp = 0; }
var tempplayer=eval("player"+nextp+".src")
document.getElementById('playerswap').src = tempplayer;
DoThePhp = 0;
}
<input type="button" value="Next" OnClick="nextplayer();javascript😃oThePhp=1;">
I have also tried $POST, $SERVER, and $_SESSION to get the variable. Any Ideas?