Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/236.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 引导模式不适用于表中的所有记录_Php_Html_Bootstrap Modal - Fatal编程技术网

Php 引导模式不适用于表中的所有记录

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-

我在PHP中使用while循环创建了一个引导模式,用于分别更新表中的每条记录,但它似乎只适用于表的第一条记录。我不知道我错在哪里。请帮帮我,让我知道哪里出了问题

代码如下:

<!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">&times;</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:&nbsp;&nbsp;&nbsp;<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>


行动