How to make php wait for the value coming from the Javascript click?

1

I'm developing a system to evaluate a user (typical of stars), but I'm having problems passing values to PHP.

Javascript code:

   function mouseClick(id){
                var valorVoto = document.getElementById(id).value
                valorVoto = valorVoto.split("#")
                voto = valorVoto[4] 
                <?php $voto = "<script>document.write(voto)</script>"; ?>
            }

PHP code:

    if(isset($voto)){
          echo 'Passou';
    }

When I open the page it does not wait for the button to click, it just echoes it.

    
asked by anonymous 15.05.2018 / 05:00

0 answers