You can discern which button is submitted by this following markup (based on your example fetched results from DB):
<?php if(isset($_POST['delete_category'])) { $id = $_POST['delete_category']; // the value="1" or value="3" goes in here echo $id; } ?> <form method="POST" action=""> <table border="1"> <tr> <th>ID</th><th>Name</th><th>Delete</th> </tr> <tr> <td>1</td> <td>Senior Pictures</td> <td><button typpe="submit" name="delete_category" value="1">Delete</button></td> <!-- each delete button has the same name, but different values --> </tr> <tr> <td>3</td> <td>Engagements</td> <td><button typpe="submit" name="delete_category" value="3">Delete</button></td> </tr> </table> </form>
If I had to guess this makes sense on the fetching: (Note: Just a sample!)
<form method="POST" action=""> <table border="1"> <tr> <th>ID</th><th>Name</th><th>Delete</th> </tr> <?php while($row = $results->fetch_assoc()): ?> <!-- assuming mysqli() --> <?php while($row = mysql_fetch_assoc($result)): ?> <!-- assuming on mysql (bleh) --> <tr> <td><?php echo $row['id']; ?></td> <td><?php echo $row['name']; ?></td> <td> <button typpe="submit" name="delete_category" value="<?php echo $row['id']; ?>">Delete</button> </td> </tr> <?php endwhile; ?> </table> </form>