title: insert JS variable in a PHP string
body: <p>Here is my code:</p>
  
  <pre><code>function myFunction2(){
        var code = document.getElementById("vehicle").value;
  
        var aux = "&lt;?php 
          $conn = oci_connect($_SESSION['user'], $_SESSION['pswd'], 'oracleps');
          $stid = oci_parse($conn,'select max(kmi) from 
                                  lloguer where lloguer.codi_vehicle="+code+"');
                 oci_execute($stid);
                 $row = oci_fetch_array($stid, OCI_BOTH);
                 $kmi=($row[0]);
                 echo $kmi;
                 ?&gt;";
  
        document.getElementById("kilometres").value= aux;}
  </code></pre>
  
  <p>I'm trying (very new on this) to update the id="vehicle" value, which is a text input, by calling the onclick="myFunction2()". 
  The main problem i find it's that inside the php string, it doesn't allow me to concat the string with the "code" var in between.</p>
  
  <p>I've tried to  cocant the whole 'document.getElementById("vehicle").value'<br>Also tried by using the concat JS method.<br></p>
  
  <p>What shall I do?</p>
  
  <p><br><br>Thank you!</p>