I'm making a school project, and I need to transfer a javascript variable to php, like, I have a javascript function called "acertou" the translation doesn't matter, but it is this:
function acertou() {
acertos++;
<?php $batata++; ?>
alert(acertos + "\n" + <?php echo $batata ?>);
}
This is a quiz, and "acertou()" is called when the person awnswers the correct option, the function increases "acertos" that is the number of correct hits and "batata" (that actually is translated as "potato" -- I don't know why) is the PHP version of the variable, but $batata doesn't increases, the alert result is:
1
1
2
1
3
1
[and keeps going]
this function is the only place when $batata is called or modifyed