0
 <-- html part -->
<input id = "username" onClick = "function1('username')"/>

// javascript part
     function function1(username){
      var username = document.getElementbyID(username).value;
   }

 <?php
  // ik this is not php code it's sql code but I'm trying to use the var username in the javascript 
  // part
   SELECT * from users where usernames = (javascript varaiable username)
    ?>

I'm trying to use the var username. In javascript inside my php I was wondering how would I do that?

dragonn
  • 311
  • 5
  • 20
  • ALso `` and in function: `function function1(field) { var username = field.value; }` – mplungjan Jun 18 '20 at 18:02
  • 1
    Js is on the client and php on the server - you must do an http request to the server - submit a form or call Ajax function – mplungjan Jun 18 '20 at 18:20

0 Answers0