title: PHP bootstrap 4 Delete button does not fetch ID
body: <p>I have done created delete button with confirmation box. However, it seems that the delete button does not work because it cannot transfer the id that i want to delete.</p>
  <p>Table for Delete button:</p>
  <pre><code> &lt;tbody&gt;
              &lt;?php
              if(mysqli_num_rows($query_run)&gt;0)
              {
                  while($row = mysqli_fetch_assoc($query_run))
                  {
                      ?&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;?php echo $row['id']; ?&gt;&lt;/td&gt;
                      
                      &lt;td&gt;&lt;?php echo $row['username']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $row['email']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?php echo $row['isAdmin']; ?&gt;&lt;/td&gt;
                      &lt;td&gt;
                          &lt;form action=&quot;register_edit.php&quot; method=&quot;post&quot;&gt;
                          &lt;input type=&quot;hidden&quot; name=&quot;edit_id&quot; value=&quot;&lt;?php echo $row['id']; ?&gt;&quot;&gt;
                          &lt;input type=&quot;hidden&quot; name=&quot;edit_isAdmin&quot; value=&quot;&lt;?php echo $row['isAdmin']; ?&gt;&quot;&gt;
                          &lt;button type=&quot;submit&quot; name=&quot;edit_btn&quot; class=&quot;btn btn-success&quot;&gt; EDIT &lt;/button&gt;
                          &lt;/form&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;button  type=&quot;button&quot;  class=&quot;btn btn-danger delete_btn&quot;  data-toggle=&quot;modal&quot; data-target=&quot;#deletemodal&quot;&gt; DELETE &lt;/button&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;?php
                  }
              }
              else{
                  echo&quot;No Record Found&quot;;
              }
              ?&gt;   
              &lt;/tbody&gt;
  </code></pre>
  <p>code for the modal:</p>
  <pre><code>&lt;form action=&quot;code.php&quot; method=&quot;POST&quot;&gt;
    &lt;div class=&quot;modal-body&quot;&gt;
      &lt;input type=&quot;hidden&quot; name=&quot;delete_id&quot; id=&quot;delete_id&quot; /&gt;
      &lt;h4&gt; Are you sure want to delete this data? &lt;/h4&gt;
    &lt;/div&gt;
    &lt;div class=&quot;modal-footer&quot;&gt;
      &lt;button type=&quot;submit&quot; name=&quot;deletedata&quot; class=&quot;btn btn-primary&quot;&gt;Yes&lt;/button&gt;
      &lt;button type=&quot;button&quot; class=&quot;btn btn-secondary delete_btn&quot; data-dismiss=&quot;modal&quot;&gt;No&lt;/button&gt;
      &lt;input type=&quot;hidden&quot; name=&quot;delete&quot; value=&quot;&quot; id=&quot;delete_id&quot; /&gt;
    &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  <p>Script that i use :</p>
  <pre><code>$(document).ready(function () {
  $('.delete_btn').on('click',function(){
      $('#deletemodal').modal('show');  
          $tr = $(this).closest('tr');
          var data = $tr.children(&quot;td&quot;).map(function(){
              return $(this).text();
          }).get();
          console.log(data) ;
          $('#delete_id').val(data[0]);
      });
  });
  
  &lt;/script
  </code></pre>