title: PHP : Return a bool from Javascript confirm method
body: <p>I want to ask the user if he wants to delete a line from the database, so I proceed like this :</p>
  
  <pre><code>&lt;script&gt;
  function show_confirm() {
      var x;
      if (confirm("Press a button!") == true) {
          x = "You pressed OK!";
      } else {
          x = "You pressed Cancel!";
      }
      document.getElementById("demo").innerHTML = x;
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>on the PHP page i call it like this :</p>
  
  <pre><code>print "&lt;a href='http://www.google.com' onclick='return show_confirm();'&gt; Google &lt;/a&gt;";
  $userAnswer = ???;
  </code></pre>
  
  <p>How do I know if the user pressed OK or CANCEL?  (so that i can do different treatement). </p>
  
  <p>Thanks in advance.</p>