- ส่งค่า ID ไปแสดงผล Pop Up ใน Bootstrap Modal .?
- จะส่งค่า ID ไปหา modal ค่ะ ผ่าน button ทำอย่างไรค่ะ … .?
- การเรียกฟังก์ชันบน bootstrap modal open .?
- การส่งผ่านข้อมูลไปยัง modal bootstrap .?
ตัวอย่าง
https://bigdata.loei1.go.th/tableBest.php?op=1.6
อ้างอิง
Link Bootstrap Popup Modal
echo "<a href='#detail$id' data-toggle='modal'><i class='fas fa-eye fa-lg'></i></a>";
echo "<a href='#delete$id' data-toggle='modal'><i class='fas fa-eye fa-lg'></i></a>";
แสดง Bootstrap Popup Modal #detail$id
//<!--start In Modal Detail -->
echo "<div id='detail$id' class='modal fade' role='dialog'>";
echo "<div class='modal-dialog modal-lg'>";
echo " <div class='modal-content'>";
echo " <div class='modal-header'>";
echo " <div class='modal-title'><i class='nav-icon fas fa-star fa-lg text-$navbarColor'></i> BEST PRACTICE ID : $id</div>";
echo " </div>";
echo " <div class='modal-body'>";
//<!-- Detail start -->
$sql="SELECT * FROM best WHERE id='$id'";
$db=mysqli_query($connect, $sql);
$rs=mysqli_fetch_array($db);
echo "<div class='card-body col-12'>";
echo "<div class='form-group row'>";
echo "<div class='col-sm-3'><div class='text-title text-info float-right'>ปี</div></div>";
echo $rs[year] ;
echo "</div>"; //.form-group row
echo "<div class='form-group row'>";
echo "<div class='col-sm-3'><div class='text-title text-info float-right'>ชื่อ - สกุล เจ้าของผลงาน</div></div>";
echo $rs[name]; //.col-sm
echo "</div>"; //.form-group row
echo "<div class='form-group row'>";
echo "<div class='col-sm-3'><div class='text-title text-info float-right'>รายละเอียด</div></div>";
echo $rs[detail] ;
echo "</div>"; //.form-group row
echo " </div>";
echo " <div class='modal-footer'>";
echo " <button type='button' class='btn btn-default' data-dismiss='modal'><i class='fas fa-times'></i> ปิด</button>";
echo " </div>";
echo " </div>";
echo "</div>";
echo "</div>";
// <!--End Modal -->
แสดง Bootstrap Popup Modal #delete$id
<!--Delete Modal -->
<div id="delete<?php echo $id; ?>" class="modal fade" role="dialog">
<div class="modal-dialog">
<form method="post" Action="index.php?page=del&id=<?php echo $id ?>">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Delete ID: <?php echo $id ?></h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<input type="hidden" name="delete_id" value="<?php echo $id; ?>">
<div class="alert alert-danger">Are you Sure you want Delete ?<strong>
<?php echo "<br">$proJName; ?></strong>
</div>
<div class="modal-footer">
<button type="submit" name="delete" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> YES</button>
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove-circle"></span> NO</button>
</div>
</div>
</div>
</form>
</div>
</div>