title: on click confirm inside php echo
body: <p>i want to be able to confirm any deletes of the mysql database before the query is executed. i checked online and found that i need to use <code>on click</code> using <code>confirm</code> javascript code when specifying the link.</p>
  
  <p>i have the following code which runs while a mysql qry is being run</p>
  
  <pre><code>echo "&lt;td&gt;&lt;a href='#' onclick='if(confirm(\"Are you sure you want to do this?\")) location.href=country.php?delete&amp;id=".$row['id']."'&gt;delete&lt;/a&gt;&lt;/td&gt;";
  </code></pre>
  
  <p>the country.php?delete&amp;id=x basically runs an <code>isset</code> and <code>_get</code> to define the id as a variable and delete the corresponding record. this works fine, just need the confirm to work. ideally i wanted it to not be embedded in the link but during the <code>isset</code> <code>_get</code></p>
  
  <p>i know there is a syntax or punctuation error somewhere but not able to tackle it.    </p>