title: delete query wont work php
body: <p>I am able to get my edit button working but when i try and click the delete button it reloads the page and nothing happens.</p>
  
  <p>html</p>
  
  <pre><code>&lt;table width='80%' border=0&gt;
      &lt;tr bgcolor='#CCCCCC'&gt;
          &lt;td&gt;ID&lt;/td&gt;
          &lt;td&gt;Voucher&lt;/td&gt;
  
      &lt;/tr&gt;
      &lt;?php 
  
          $vouchlist = mysqli_query($mysqli, "SELECT * FROM vouchers");
      while($resvouch = mysqli_fetch_array($vouchlist)) {         
          echo "&lt;tr&gt;";
          echo "&lt;td&gt;".$resvouch['id']."&lt;/td&gt;";
          echo "&lt;td&gt;".$resvouch['voucher']."&lt;/td&gt;";
          echo "&lt;td&gt;&lt;a href=\"editvoucher.php?id=$resvouch[id]\"&gt;Edit&lt;/a&gt; | 
                    &lt;a href=\"deletevoucher.php?id=$resvouch[id]\" onClick=\"return confirm('Are you sure you want to delete?')\"&gt;Delete&lt;/a&gt;&lt;/td&gt;";        
      }
      ?&gt;
  &lt;/table&gt;      
  </code></pre>
  
  <p>deletevoucher.php</p>
  
  <pre><code>$id = $_GET['id'];
  //deleting the row from table
  $result = mysqli_query($mysqli, "DELETE FROM vouchers WHERE id = $id ");
  header("Location:protected_page.php");
  </code></pre>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>added this to my deletevoucher. i get this "2Data added successfully.
  Back to Admin Page." returned. i get the value that i click on my main php page. but it still is not deleteing...</p>
  
  <pre><code>$id = $_GET['id'];
  
  // checking empty fields
  if(empty($id) ) {                
      if(empty($id)) {
          echo "&lt;font color='red'&gt;voucher id is empty.&lt;/font&gt;&lt;br/&gt;";
      }
  
  
      //link to the previous page
      echo "&lt;br/&gt;&lt;a href='~Airways/protected_page.php'&gt;Go Back&lt;/a&gt;";
  } else { 
      // if all the fields are filled (not empty)             
      //insert data to database
      $result = mysqli_query($mysqli, "DELETE FROM vouchers WHERE (id) = ('$id') ");
  
  
      //display success message
      echo $id;
      echo "&lt;font color='green'&gt;Data added successfully.";
      echo "&lt;br/&gt;&lt;a href='protected_page.php'&gt;Back to Admin Page.&lt;/a&gt;";
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/YXnO9.png" rel="nofollow noreferrer">Table structure</a></p>