title: How can I dynamic pass value to my modal with button?
body: <pre><code>&lt;table class=&quot;table&quot;&gt;
          &lt;tr&gt;
              &lt;td colspan=&quot;12&quot; class=&quot;text-center bg-primary text-white&quot; style=&quot;font-size:20px;&quot;&gt;List all people&lt;/td&gt;
          &lt;/tr&gt;
          &lt;?php 
          if($result-&gt;num_rows&gt;0){
              while($row=$result-&gt;fetch_assoc()){
                  $people=new People;
                  $people-&gt;id=$row['id'];
                  $people-&gt;firstname=$row['firstname'];
                  $people-&gt;lastname=$row['lastname'];
                  $people-&gt;email=$row['email'];
                  $people-&gt;registerdate=$row['reg_date'];
                  echo &quot;&lt;tr&gt;
                  &lt;td style='width:60px;' name='id'&gt;$people-&gt;id&lt;td&gt;
                  &lt;td&gt;$people-&gt;firstname&lt;td&gt;
                  &lt;td&gt;$people-&gt;lastname&lt;td&gt;
                  &lt;td&gt;$people-&gt;email&lt;td&gt;
                  &lt;td&gt;$people-&gt;registerdate&lt;td&gt;
                  &lt;td&gt;&lt;button class='btn btn-danger w-100' data-toggle='modal' data-target='#mymodal'&gt;Action&lt;/button&gt;&lt;td&gt;
                  &lt;tr&gt;&quot;;
                  require('modal.php');
              }
          }
          ?&gt;
          &lt;div class=&quot;modal fade&quot; id=&quot;mymodal&quot;&gt;
              &lt;div class=&quot;modal-dialog modal-lg&quot;&gt;
                  &lt;div class=&quot;modal-content&quot;&gt;
                      &lt;div class=&quot;modal-header&quot;&gt;
                          &lt;h4 class=&quot;modal-title&quot;&gt;&lt;?php echo &quot;User : $people-&gt;firstname $people-&gt;lastname&quot; ?&gt;&lt;/h4&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;modal-body&quot;&gt;
                          &lt;label for=&quot;&quot;&gt;User ID&lt;/label&gt;
                          &lt;input type=&quot;text&quot; class=&quot;form-control&quot; value=&quot;&lt;?php echo $people-&gt;id ?&gt;&quot;&gt;
                          &lt;label for=&quot;&quot;&gt;First name&lt;/label&gt;
                          &lt;input type=&quot;text&quot; class=&quot;form-control&quot; value=&quot;&lt;?php echo $people-&gt;firstname ?&gt;&quot;&gt;
                          &lt;label for=&quot;&quot;&gt;Last name&lt;/label&gt;
                          &lt;input type=&quot;text&quot; class=&quot;form-control&quot; value=&quot;&lt;?php echo $people-&gt;lastname ?&gt;&quot;&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;modal-footer&quot;&gt;
                          modal footer
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/table&gt;
  </code></pre>