I'm using a Bootstrap modal popup window,this is the button and url
<a id="changeStatusDataID" class="btn btn-success changeStatusDataID" title="Change status" data-bs-toggle="modal" data-id="' . $a['rmaID'] . '" data-bs-target="#complete_rma_modal"><i class="fa-solid fa-check"></i></a>
<div class="modal fade" id="complete_rma_modal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" style="align-items: center;">
<img style="width: 20px; height: 20px; margin-right: 5px;" src="assets/confirm.png" alt="Change Icon">
<h5 class="modal-title"> Change RMA Status </h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<script>
$('.changeStatusDataID').click(function() {
var id = $(this).attr('data-id');
console.log(id);
$('#complete_rma_modal').find('.modal-body').html(id);
});
</script>
<div class="modal-body">
<?php
include('php/database/config.php');
$id = "";
$sql = "select rmaStatus from rma where rmaID = $id";
$result = $connection->query($sql);
if ($result->num_rows > 0) {
while ($a = $result->fetch_assoc()) {
if ($a['rmaStatus'] == 0) {
echo "Are you sure you want to change the status of this RMA to 'Completed'?";
} else {
echo "Are you sure you want to change the status of this RMA back to 'In Progress'?";
}
}
}
$connection->close()
?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<a onclick="getDataIDAttributeChangeStatus()" class="btn btn-success">Change Status</a>
</div>
</div>
</div>
</div>
I've gotten the jquery to go get the data-id, but now I'm lost at trying to get the variable from the modal HTML like the jquery did into the php function to select the rma status' from the database
how would I do this?