title: PHP bootstrap 4 modal delete button in each row
body: <p>Good day! I got a error that says "Undefined variable: id".</p>
  
  <p>I created a table which has a delete button in each row, when clicked pops up an modal and asks if I want to delete the row. But when ever I click on the delete button it says the error Undefined variable: id and doesn't delete the data.</p>
  
  <p>Here's my table code:   </p>
  
  <pre><code>if(isset($_POST['delete'])) {
          $data-&gt;delete_multiple($id, $conn);
  
      }
  
      &lt;table class="table table-hover table-bordered" id="table1"&gt;
                                      &lt;thead&gt;
                                          &lt;tr&gt;
                                              &lt;th&gt;Faculty Code&lt;/th&gt;
                                              &lt;th&gt;Last Name&lt;/th&gt;
                                              &lt;th&gt;First Name&lt;/th&gt;
                                              &lt;th&gt;Middle Name&lt;/th&gt;
                                              &lt;th&gt;Position&lt;/th&gt;
                                              &lt;th&gt;&lt;/th&gt;
                                              &lt;th&gt;Status&lt;/th&gt;
                                          &lt;/tr&gt;
                                      &lt;/thead&gt;
                                      &lt;tbody&gt;
                                          &lt;?php  while ($row = $result -&gt; fetch_object()): ?&gt;
                                          &lt;tr&gt;
                                              &lt;td&gt;&lt;?php echo  $row-&gt;Faculty_ID;?&gt;&lt;/td&gt;
                                              &lt;td&gt;&lt;?php echo $row-&gt;Faculty_Lastname ?&gt;&lt;/td&gt;
                                              &lt;td&gt;&lt;?php echo $row-&gt;Faculty_Firstname ?&gt;&lt;/td&gt;
                                              &lt;td&gt;&lt;?php echo $row-&gt;Faculty_Middlename?&gt;&lt;/td&gt;
                                              &lt;td&gt;&lt;?php echo $row-&gt;Position; ?&gt;&lt;/td&gt;
                                              &lt;td class="text-center"&gt;
                                                  &lt;a  class="btn btn-sm btn-outline-primary text-muted" href="Faculty_edit.php?Faculty_ID=&lt;?php echo $row-&gt;Faculty_ID;?&gt;"&gt;Edit&lt;/a&gt;
                                                  &lt;a type="button"  title="Delete Faculty" data-toggle="modal" data-target="#delete_modal"  class="btn btn-sm btn-outline-danger" &gt;Delete&lt;/button&gt;&lt;/td&gt;
                                              &lt;td&gt;
                                                  &lt;?php if($row-&gt;Status=='Active') echo '&lt;a href="#deactive_account" data-toggle="modal" data-id='.$row-&gt;Faculty_ID.' class="activate" style="color:green;"&gt;Active&lt;/a&gt;'; ?&gt;
                                                  &lt;?php if($row-&gt;Status=='Inactive') echo '&lt;a href="#active_modal" data-toggle="modal" data-id='.$row-&gt;Faculty_ID.' class="activate" style="color:red;"&gt;Inactive&lt;/a&gt;'; ?&gt;
                                              &lt;/td&gt;
                                          &lt;/tr&gt;
                                          &lt;?php endwhile; ?&gt;
                                      &lt;/tbody&gt;
                                  &lt;/table&gt;
  </code></pre>
  
  <p>My modal code:</p>
  
  <pre><code>&lt;div class="modal fade" id="delete_modal" role="dialog"&gt;
                        &lt;div class="modal-dialog"&gt;
                          &lt;div class="modal-content"&gt;
                            &lt;!-- Modal Header --&gt;
                            &lt;div class="modal-header"&gt;
                              &lt;h4 class="modal-title"&gt;Delete Confirmaiton&lt;/h4&gt;
                              &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
                            &lt;/div&gt;
                            &lt;!-- Modal body --&gt;
                            &lt;div class="modal-body"&gt;
                              &lt;div class="alert alert-danger" role="alert"&gt;
                                Are you sure you want to delete selected record?
                              &lt;/div&gt;
                            &lt;/div&gt;
                            &lt;!-- Modal footer --&gt;
                            &lt;div class="modal-footer"&gt;
                              &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;No&lt;/button&gt;
                              &lt;button type="submit" class="btn btn-danger" name="delete"&gt;Yes&lt;/button&gt;
                            &lt;/div&gt;
                          &lt;/div&gt;
                        &lt;/div&gt;
                      &lt;/div&gt;
  </code></pre>
  
  <p>Delete function code:</p>
  
  <pre><code> function delete_multiple($id, $conn){
  
  
           $id = $_POST['delete'];
           $sql = "DELETE FROM faculty WHERE Faculty_ID=? ";
              $stmt = $conn-&gt;prepare($sql);
              $stmt-&gt;bind_param("i", $id);
              $stmt-&gt;execute();    
          }
  </code></pre>