title: show a confirmation box before deleting a row of the table
body: <p>I have a table whose view is something like this</p>
  
  <pre><code>ID  NAME  LOCATION  DELETE
  1   sam   US        delete
  </code></pre>
  
  <p>I have a statement from the table that deletes the given row</p>
  
  <pre><code>echo "&lt;td&gt;&lt;a href=\"delete_members.php?id=".$row['id']."\"&gt;Delete&lt;/a&gt;&lt;/td&gt;";
  </code></pre>
  
  <p>It redirects to delete_members.php page and the row gets deleted, however i wish to display an alert box that makes sure that the user wants to delete the row or not. for it i have a code</p>
  
  <pre><code>&lt;button onclick="myFunction()"&gt;Delete&lt;/button&gt;
  
  &lt;script&gt;
  function myFunction() {
      var x;
      if (confirm("Press a button!") == true) {
          window.location="yourphppage.php"; // not sure which link should be placed here
          return true;
      } else {
          window.location="index.php";
          return true;
      }
      document.getElementById("demo").innerHTML = x;
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>code for the delete_members.php page</p>
  
  <pre><code>&lt;?php
  include('admin_session.php');
  $con=mysqli_connect("abc.com","abc","abc","abc");
  // Check connection
  if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
  
  $id = $_GET['id']; 
  
  mysqli_query($con,"DELETE FROM members WHERE id='".$id."'");
  mysqli_close($con);
  header("Location: admin_member_list.php");
  ?&gt; 
  </code></pre>
  
  <p>However, i am unable to use the confirmation script with the statement in a proper way. i want that the alert box gets popped up(i.e the script runs) after i click on the edit button that is present on the first statement given above and then if the user confirms it should run the delete_members.php script. would appreciate if someone could guide me  </p>