title: Sweet Alert confirmation before delete
body: <p>Hi I am new in using sweet alert js to make my alert box more fancy. I am using the normal javascript alert confirmation to delete a specific data in my table. However when I try to run a sweet alert confirmation before deleting it deletes the file without the confirmation popping up.</p>
  
  <p>Here is the code in my JS below.</p>
  
  <pre><code>&lt;script&gt;
      archiveFunction() {
          swal({
    title: "Are you sure?",
    text: "But you will still be able to retrieve this file.",
    type: "warning",
    showCancelButton: true,
    confirmButtonColor: "#DD6B55",
    confirmButtonText: "Yes, archive it!",
    cancelButtonText: "No, cancel please!",
    closeOnConfirm: false,
    closeOnCancel: false
  },
  function(isConfirm){
    if (isConfirm) {
      swal("Deleted!", "Your imaginary file has been archived.", "success");
    } else {
      swal("Cancelled", "Your imaginary file is safe :)", "error");
    }
  });
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>this is my html form below.</p>
  
  <pre><code>&lt;form action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="POST"&gt;
          &lt;input type="hidden" name="p_id" id="p_id" value="&lt;?php echo $rows['p_id']; ?&gt;"&gt;
          &lt;button class="btn btn-danger" type="submit" name="archive" onclick="archiveFunction()"&gt;
              &lt;i class="fa fa-archive"&gt;&lt;/i&gt;
                  Archive
          &lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and here is the code in php.</p>
  
  <pre><code>&lt;?php
  
  include('../config.php');
  
  if(isset($_POST['archive']))
  {
  $p_id = $_REQUEST['p_id'];
  // sql to delete a record
  $sqli = "UPDATE students SET archive = 2 WHERE p_id=$p_id";
  
  if ($conn-&gt;query($sqli) === TRUE) {
      echo "swal('Archived!', 'Click ok to see!', 'success')";
  } else {
      echo "Error Archiving record: " . $conn-&gt;error;
  }
  
  $conn-&gt;close(); 
  }
  ?&gt;
  </code></pre>
  
  <p>what I want to happen is to confirm the sweet alert confirmation before deleting the specific data.</p>