所以我有一个列出用户的表格,以及每个要用模态编辑的行按钮。我顺便使用while循环,但我的问题是每次单击行中的任何按钮时它只会获得最后一行。我通过浏览器检查了每行的ID,他们有正确的ID。它只是当我点击它给出最后一行。我有点困惑,因为我尝试使用bootstrap模式并且我的代码工作正常但是在物化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">