I have a table that outputs data from a mySQL database, and displays a ID and a button in each column as shown here:
echo "<td>".$claimRow["id"]."</td>";
echo "<td><button type='button' data-toggle='modal' data-target='#exampleModal'>Submit Claim</button></td>";
When you click the button, a modal appears:
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<?php include('includes/claim.php'); ?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
This should show a unique modal for each row, but I am unsure how to pass the row ID to the modal, and then to add to my lack of knowledge... I am trying to pass the ID to the include, I tried:
<?php include('includes/claim.php?id='.$claimRow["id"]); ?>
However, for some reason it does not like me passing through the variable on an include file.
Then, how do I overcome this error? I have tried searching but have failed to come across anything similar (Although, I may be using the wrong key words).