Php 引导模式不适用于表中的所有记录
我在PHP中使用while循环创建了一个引导模式,用于分别更新表中的每条记录,但它似乎只适用于表的第一条记录。我不知道我错在哪里。请帮帮我,让我知道哪里出了问题 代码如下:Php 引导模式不适用于表中的所有记录,php,html,bootstrap-modal,Php,Html,Bootstrap Modal,我在PHP中使用while循环创建了一个引导模式,用于分别更新表中的每条记录,但它似乎只适用于表的第一条记录。我不知道我错在哪里。请帮帮我,让我知道哪里出了问题 代码如下: <!DOCTYPE html> <html> <body> <?php $sql = "SELECT * FROM fee_status"; $result = $conn->query($sql); $i = 1; if ($result-
<!DOCTYPE html>
<html>
<body>
<?php
$sql = "SELECT * FROM fee_status";
$result = $conn->query($sql);
$i = 1;
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
?>
<table>
<tr>
<td width='5%'><?php echo $i++; ?></td>
<td width='20%'><?php echo $row["student_id"]; ?><br><?php echo $row["student_name"]; ?></td>
<td width='10%'><?php echo $row["fee_due"]; ?></td>
<td width='25%'>
<div class="dropdown">
<button class='btn btn-primary dropdown-toggle' type='button' id='dropdownMenuButton' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>Actions</button>
<div class='dropdown-menu' aria-labelledby='dropdownMenuButton'>
<a class='dropdown-item' data-toggle='modal' data-target="#myModal<?php echo $row['student_id']; ?>">Update Payment</a>
</div>
</div>
</td>
</tr>
</table>
<div class="modal" role="dialog" id="myModal<?php echo $row['student_id']; ?>">
<div class="modal-dialog" role="document" style="max-width: 65%;">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Update Payment</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form id="update_payment_form" class="form-group" action="update_fee.php" method="post">
<div class='form-group required'>
<div class="row">
<div class="col-md-6">
Student Details: <input type="text" name="student_details" value='<?php echo $row['student_id']; ?> - <?php echo $row['student_name']; ?>' style='width: 70%;' readonly>
</div>
</div>
<br>
<div class="row">
<div class="col-md-6">
Amount: <input type="number" name="new_payment" placeholder='<?php echo $row['fee_due']; ?>' style='width: 40%;' required>
</div>
</div>
<br>
<div class="row">
<div class="col-md-6">
Date: <input id="date-field" type="date" name="date" style='width: 40%;'>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" onclick="form_submit()" class="btn btn-primary">Update</button>
</div>
</div>
</div>
</div>
<?php
}
}
?>
</body>
</html>
行动