title: Want to pass php variable as argument in javascript function?
body: <p><br>
  i want to pass my php variable in one javascript function.<br>
  i know it seems simple but i don't know where am i missing something?</p>
  
  <pre><code>    &lt;?php
          while($gg=mysql_fetch_array($lg))
          {
      ?&gt;
          &lt;td id="add_td"&gt;
          &lt;?php
          $id = $gg['p_id'];
          echo "&lt;a onclick=cnf('Are you sure you want to delete that?',$id)&gt;"; ?&gt;Delete&lt;/a&gt;
          &lt;/td&gt;
  &lt;?php
          }
  ?&gt;
  </code></pre>
  
  <p>and in my javascript function</p>
  
  <pre><code>function cnf(msg,id)
  {
  
       cnf = confirm(msg);
       if(cnf) { 
              parent.location.href = 'p_update.php?d=' + id;          
       }
  }
  </code></pre>
  
  <p>so i need to know on which id that user had clicked so that i will only delete that id from database.<br>
  if i try this thing then it showing error on "cnf" function and its saying like "unterminated string literal"?<br></p>