materialiecss模式仅在单击按钮时从表中获取最后一行

o2g1uqev  于 2021-06-25  发布在  Mysql
关注(0)|答案(0)|浏览(241)

所以我有一个列出用户的表,每行有一个按钮可以在modal中编辑。顺便说一句,我正在使用while循环,但我的问题是每次单击行中的任何按钮时,它都只获取最后一行。我通过浏览器中的inspect检查了每一行的id,他们的id是正确的。只是当我点击它时,它给出了最后一行。我有点困惑,因为我尝试了引导模式,我的代码工作得很好,但在具体化css,不是。
我的循环,循环里面是tr和td。

while ($row = mysqli_fetch_assoc($select_user)){

               $account_id          = $row['account_id'];
            $username            = $row['username'];
            $firstname           = $row['firstname'];
            $middlename          = $row['middlename'];
            $lastname            = $row['lastname'];
            $house_number        = $row['house_number'];
            $street_name         = $row['street_name'];
            $provincial_address  = $row['provincial_address'];
            $gender              = $row['gender'];
            $occupation          = $row['occupation'];
            $cel_number          = $row['cel_number'];
            $tel_number          = $row['tel_number'];

            $house_model_name    = $row['house_model_name'];

            $mdues_status        = $row['mdues_status'];
            $account_status_name = $row['account_status_name'];

            $address = '#'. $house_number.' '.$street_name;
            $fullName = $firstname.' '.$middlename[0].'. '.$lastname;
            $fullContact = $cel_number.' , '.$tel_number;

}
这是按钮

echo "<td><button class='waves-effect waves-light btn update modal-trigger' data-toggle='modal'  data-target='billingModal' id='{$account_id}' style='margin: 5px; background-color: #6E6702;'><i class='material-icons left'>create</i>Edit</button></td>";

这是模态

<div id="billingModal" class="modal" role="dialog">

      <div class="modal-content">
        <h5><?php echo $account_id?></h5> <!--Name of home owner-->
        <div class="divider"></div>
        <p><?php echo $address?><br> <!--Address of home owner-->
        09152462389</p><!--Contact Number of home owner-->
      </div> <!--TABLE FOR BILL-->
      <!-- <input type="input" id="id"> -->

      <div style="margin: 20px;">
        <div class="row">
          <h5><span style"background-color: #B7AFAF;">Billing Summary</span></h5>
          <div class="divider"></div>

          </div>
      </div>
      <div class="modal-footer">
        <a href="#!" class="modal-action modal-close waves-effect waves-green btn" style="margin: 5px; background-color: #B7AFAF;">Close</a>
        <a href="#!" class="modal-action modal-close waves-effect waves-green btn" style="margin: 5px; background-color: #B7AFAF;">Print</a>
        <a href="#!" class="modal-action modal-close waves-effect waves-green btn" style="margin: 5px; background-color: #108DC9;">Pay</a>
      </div>
    </div>

我也试过在巴顿这样做

echo "<td><button class='waves-effect waves-light btn update modal-trigger' data-toggle='modal'  href=#billingModal$account_id;' style='margin: 5px; background-color: #6E6702;'><i class='material-icons left'>create</i>Edit</button></td>";

在模态中

<div id="billingModal<?php echo $account_id; ?>" class="modal" role="dialog">

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题