title: JavaScript Popup not working with conditional statement
body: <p>I'm new to JavaScript.. Am facing a problem trying to pass a PHP variable to JavaScript, using HTML
      
  tag to redirect to a page. Here's my code:</p>
  
  <pre><code>echo "
  &lt;a href='javascript:var r = confirm(\"Are you sure you want to delete this file?
  (This action cannot be undone)\"); if (r == true) {
   window.location=\"/delete.php?id=\"" . $row['ID'] . "\"; }'&gt;Delete File?&lt;/a&gt;)
  ";
  </code></pre>
  
  <p>It appears like this in the browser source window, which seemed perfect to me, but it isn't..</p>
  
  <pre><code>      &lt;a href='javascript:var r = confirm("Are you sure you want to delete this file?
  (This action cannot be undone)"); if (r == true) { window.location="/delete.php?id="51524629";
  }'&gt;Delete File?&lt;/a&gt;
  </code></pre>
  
  <p>My code works if I just use the confirm popup code, removing the if statement.. However, if I use this complete code to redirect to the delete.php file if the user confirms to the popup box confirmation, the confirmation popup doesn't show up.. Plz help me rectify my code..</p>