复选框和PHP中的数据库删除循环时

I am trying to allow a user to delete any one of these rows by clicking on the delete button for that respective row. Unfortunately, when they click delete, it deletes all of the rows. What am I doing wrong? Here is what the table looks like:

  • $metakey | $meta_value | Delete Button

    $metakey | $meta_value | Delete Button

    $metakey | $meta_value | Delete Button

<?php while($row=mysql_fetch_array($followerresult)){ $meta_key=$row["meta_key"]; $meta_value=$row["meta_value"];

echo "<table><tr> 
    <td>$meta_key</td> 
    <td>$meta_value</td> 
    <td><form ID='deleteform' method='POST'>
    <div id='mySubmit'>
    <input type='submit' name='Delete' value='Delete'>

    </form></td> 
</tr>"; 

 if (isset($_POST['Delete'])) {

                //SQL Delete

               echo $wp_login . " has been removed from access permissions";

}

echo "";

    ?>

The $meta_key and $meta_value are not part of the form. You need these to be input fields within the form and then use their values within the POST request. Rather than looping through and creating a table, instead loop through and create a full functional form with the correct inputs etc.

You need to add hidden field to your HTML form.

<input type='hidden' name='meta_key' value='$meta_key' />

And, you must add WHERE clause to your SQL DELETE statement.