Merhaba arkadaşlar,
Bootstrap 4'de modal'a data-id gönderiyorum.
ve bu data-id ile SQL sorgusu çekmem gerekiyor ama yapamadım bir türlü.
Yardımcı olur musunuz?
<!--Modal-->
<a data-toggle="modal" data-target="#kullanici_duzenle" data-id="<?php echo $liste["kullanici_id"]?>" href="#" class="text-info" title="Sil"><i class="fas fa-kullanici-minus"></i></a>
<form action="" method="GET">
<div class="modal fade" id="kullanici_duzenle" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalCenterTitle">Kayıt değiştirme</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<table class="table">
<?php
$kullaniciAra = $db->query("select * from kullanicilar where kullanici_id=?")
->data(array($kullanici_id))
->select(1);
?>
<thead>
<tr>
<th scope="col">Kullanıcı Adı</th>
<th scope="col">E-mail</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="roomNumber"></span></td>
<td>aa</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">İptal</button>
<button type="submit" class="btn btn-danger">Onayla</button>
</div>
</div>
</div>
</div>
</form>
<script>
$('#kullanici_duzenle').on('show.bs.modal', function (e) {
var myRoomNumber = $(e.relatedTarget).attr('data-id');
$(this).find('.roomNumber').text(myRoomNumber);
});
</script>