title: concatening PHP variable and strings inside double quotes for onclick event
body: <p>The button when pressed call a function that needs the sn value, but the code below fails with the Chrome debug message:</p>
  
  <blockquote>
    <p>Uncaught ReferenceError: Telephony is not defined</p>
  </blockquote>
  
  <p>Telephony is one of the service names.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;someTitle&lt;/title&gt;
  &lt;script&gt;
  function myF(varname) {
      //I'll do here some other task with varname
      console.log(varname);
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;pre&gt;
  &lt;?php
  $sn='noname';
  //here, the code to connect and select DB
  while ($reg=mysql_fetch_array($registers))
  
  {
   echo "Service Name: ".$reg['sname']."&lt;br&gt;";
   $sn = $reg['sname'];
  
   echo "&lt;button onclick=\"myF($sn)\"&gt;Vote&lt;/button&gt;";
   echo "&lt;hr&gt;";
  }
  
  mysql_close($conexion);
  ?&gt;
  &lt;/pre&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Is it possible a simple solution? My PHP server has PHP5</p>