|
|
|
สอบถามหน่อยครับ ทำไมข้อมูลมาไม่ตรง เวลาเรากดปุ๋ม ว่าง แล้วข้อมูลใน Modal ส่งค่ามาไม่ตรง |
|
|
|
|
|
|
|
โค้ด หน้า modal.php
<?php
include('connectdb.php');
$sql = "SELECT field_id, field_img, time_name, price FROM field_db, time_db";
$result = $conn->query($sql);
foreach($result as $row){
?>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">ข้อมูลการจอง</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="detail">
<div class="mb-3">
<div class="form-group row">
<label class="col-sm-2 ">สนาม :</label>
<div class="col-sm-2">
<img src="image/<?php echo $row['field_img']?>" alt="." width="350" height="250">
<br><br>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 ">วันที่ :</label>
<div class="col-sm-5">
<input type="date" name="booking_date" class="form-control"
value="<?php echo date('Y-m-d');?>">
<br>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 ">เวลา :</label>
<div class="col-sm-4">
<input type="" name="time" class="form-control"
value="<?php echo date("H:i:s",strtotime($row['time_name']))?>">
<br>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 ">ราคา :</label>
<div class="col-sm-4">
<input type="" name="" class="form-control" value="<?php echo $row['price']?>">
<br>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 ">ชื่อ :</label>
<div class="col-sm-4">
<input type="" name="" class="form-control" value="">
<br>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 ">โทร :</label>
<div class="col-sm-4">
<input type="" name="" class="form-control" value="">
<br>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-bs-dismiss="modal">ยกเลิก</button>
<button type="button" class="btn btn-secondary">บันทึกการจอง</button>
</div>
</div>
</div>
</div>
</div>
<?php }?>
|
|
|
|
|
Date :
2021-06-18 21:17:45 |
By :
delete |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
โค้ดปุ๋มกดว่าง
<?php if($row['status_id'] == 1) { ?>
<div class="d-grid gap-2">
<button type="button" class="btn btn-secondary" data-bs-toggle="modal"
data-bs-target="#exampleModal">ว่าง</button>
</div>
<?php }else{ ?>
<div class="d-grid gap-2">
<button type="button" class="btn btn-danger">ไม่ว่าง</button>
</div>
<?php } ?>
|
|
|
|
|
Date :
2021-06-18 21:19:14 |
By :
delete |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2021-06-18 21:20:32 |
By :
delete |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
https://stackoverflow.com/a/3770634
https://stackoverflow.com/a/45982331
|
|
|
|
|
Date :
2021-06-19 07:09:59 |
By :
พญามัจจุราช |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|