title: Delete user from database - GET method change to POST method
body: <p>My question is how can i change GET method to the POST method after click action on the delete button on page Users List.</p>
  
  <p>After delete using POST on top of page users.php must be message "User $name deleted!"</p>
  
  <p>users.php</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"/&gt;
      &lt;title&gt;Users&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;h1&gt;Users List&lt;/h1&gt;
  
  &lt;?php
  include('db_connect.php');
  
  $db_conn = @new mysqli($host, $db_user, $db_password, $db_name);
  
  
  if($result=$db_conn-&gt;query("SELECT * FROM user ORDER BY id")){
      if($result-&gt;num_rows &gt; 0){
  
  
          echo "&lt;table border='1' cellpadding='10'&gt;";
          echo "&lt;tr&gt;&lt;th&gt;ID&lt;/th&gt;&lt;th&gt;Name&lt;/th&gt;&lt;/tr&gt;";
  
  
          while($row=$result-&gt;fetch_object()){
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;".$row-&gt;id."&lt;/td&gt;";
              echo "&lt;td&gt;".$row-&gt;name."&lt;/td&gt;";
              echo "&lt;td&gt;&lt;a href='delete.php?id=" . $row-&gt;id . "'&gt;Delete&lt;/a&gt;&lt;/td&gt;";
              echo "&lt;/tr&gt;";
          }
  
          echo "&lt;/table&gt;";
  
      }else{
          echo "No records";
      }
  }else{
      echo "error: ". $db_conn-&gt;error;
  }
  
  $db_conn-&gt;close();
  
  ?&gt;
  
  &lt;br&gt;&lt;a href="add.php"&gt;Add user&lt;/a&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>delete.php</p>
  
  <pre><code>&lt;?php
  
  require_once 'db_connect.php';
  
  
  $db_conn = @new mysqli($host, $db_user, $db_password, $db_name);
  
  if (isset($_GET['id']) &amp;&amp; is_numeric($_GET['id']))
  {
  
      $id = $_GET['id'];
  
  
      if ($stmt = $db_conn-&gt;prepare("DELETE FROM user WHERE id = ? LIMIT 1"))
      {
          $stmt-&gt;bind_param("i",$id);
          $stmt-&gt;execute();
          $stmt-&gt;close();
      }
      else
      {
          echo "ERROR: could not prepare SQL statement.";
      }
      $db_conn-&gt;close();
  
  
      header("Location: users.php");
  }
  else
  
  {
      header("Location: users.php");
  }
  </code></pre>
  
  <p>Please help! :)</p>