title: Pass php string as parameter for javascript function called in php script
body: <p>So I have this serie of radio buttons generated by a php script that call a javascript function when they get clicked on: </p>
  
  <pre><code>&lt;?php
      $databases = mysqli_query($link, "SHOW DATABASES");
      while($row = mysqli_fetch_row($databases)) {
          $db = $row[0];
          echo "&lt;input type='radio' name='database' id='".$db."' onclick='displaydbcontent(".$db.")'&gt;";     
      }
  ?&gt;
  </code></pre>
  
  <p>The javascript function then has to alert the content of the string:</p>
  
  <pre><code>function displaydbcontent(dbid) {
      alert("This is a test");
      alert(dbid);
  }
  </code></pre>
  
  <p>Now, no matter what the content of the variable $db is, after displaying the first alert printing "This is a test", the second one always prints "[object HTMLInputElement]".</p>
  
  <p>I am pretty sure that it's all a matter of quotation marks, but I don't see any way to work around it.</p>
  
  <p>And for those who are wondering about it even thought it hasn't to do much with my issue, the $link variable has been initializated and works correctly.</p>