title: How to delete a row in php?
body: <p>I made from in php. When I select a class, for example I select the class9, it shows me the table of class9. I also have inserted a row in the table containing the delete button to delete the corresponding row.  Now I want to delete a row buy clicking the button which is in the row. how can I do that?
  <br>First I choose a class from this option as in the image below ;<a href="https://i.stack.imgur.com/tzSuI.jpg" rel="nofollow noreferrer">The image from which we select the class</a> <br>
  And then the corresponding table is going to be shown. <br>
   <a href="https://i.stack.imgur.com/tzSuI.jpg" rel="nofollow noreferrer">This is the image. When I click on the button, the corresponding row should be deleted.</a></p>
  
  <pre><code>&lt;?php
  include "connection.php";
  ?&gt;
  
  &lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;KDR&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  
      &lt;table border="2px" width="50%" height="auto"&gt;
      &lt;tr&gt;
          &lt;th&gt;No&lt;/th&gt;
          &lt;th&gt;Name&lt;/th&gt;
          &lt;th&gt;F/Name&lt;/th&gt;
          &lt;th&gt;Age&lt;/th&gt;
          &lt;th&gt;Delete&lt;/th&gt;
      &lt;/tr&gt;
      &lt;?php
      $table = $_POST['formCountry'];
      $sql = "SELECT * FROM $table";
      $result = $conn-&gt;query($sql);
      while($row = $result-&gt;fetch_assoc())
      {
          echo "&lt;tr&gt;";
          echo "&lt;td&gt;" . $row['id'] . "&lt;/td&gt;";
          echo "&lt;td&gt;" . $row['name'] . "&lt;/td&gt;";
          echo "&lt;td&gt;" . $row['fname'] . "&lt;/td&gt;";
          echo "&lt;td&gt;" . $row['age'] . "&lt;/td&gt;";
          echo "&lt;td&gt;&lt;form method='POST' &gt;&lt;input type='submit' name='deletestudent' value='Delete'/&gt;&lt;/form&gt;&lt;/td&gt;";
          echo "&lt;/tr&gt;";
      }
      ?&gt;
   &lt;/table&gt;
  
   &lt;/body&gt;
  </code></pre>