我遇到了一个弹出表单的问题,该表单有一个字段,用户需要在其中输入有关一行数据的一些信息。
他/她输入的内容需要插入到我将执行更新查询的表中......但我的问题是表单回显是源代码中数据库中的 id 但当我将鼠标悬停在按钮。
在我按下按钮后,它只执行第一个 id 的查询。其他只显示第二个,依此类推,直到它们被一一删除。我不知道我做错了什么:
<?php include_once('classes/profile.class.php');?>
<?php include_once('header.php');?>
<h1>
<?php _e('Traffic Fines Adjudication'); ?>
</h1>
<br>
<div class="tabs-left">
<?php
$result = "SELECT * FROM login_fines_adjudicated WHERE active = 0 ORDER BY date_issued";
$stmt = $generic->query($result);
//this function will take the above query and create an array
while($row = $stmt->fetch(PDO::FETCH_ASSOC))
{
//do nothing
//with the array created above, I can create variables (left) with the outputted array (right)
$id = $row['id'];
$date = $row['date_added_db'];
$date_issued = $row['date_issued'];
$time_arrive = $row['time_arrived'];
$time_depart = $row['time_departed'];
$ref = $row['reference_code'];
$reason = $row['violation_reason'];
$location = $row['location'];
$bay = $row['bay_number'];
$licence = $row['licence'];
$punit = $row['parking_unit'];
$value = $row['value'];
$operator = $row['operator'];
$operator_id = $row['operator_id'];
//If date field is empty display nothing! Or sentence...
if(!empty($date))
{
?>
<table class="table">
<thead>
<tr>
<th>Photo</th>
<th>Date Added</th>
<th>Date Issued</th>
<th>Time Arrived</th>
<th>Time Departed</th>
<th>Reference Code</th>
<th>Violation Category</th>
<th>Location</th>
<th>Bay Number</th>
<th>Licence Plate</th>
<th>Parking Unit</th>
<th>Amount</th>
<th>Operator Name</th>
<th>Operator ID</th>
<th>Action</th>
</tr>
</thead>
<tr>
<td><img class="photo" src="photos/no-available.jpg" /></td>
<td><?php echo $date; ?><br /></td>
<td><?php echo $date_issued; ?></td>
<td><?php echo $time_arrive; ?></td>
<td><?php echo $time_depart; ?></td>
<td><?php echo $ref; ?></td>
<td><?php echo $reason; ?></td>
<td><?php echo $location; ?></td>
<td><?php echo $bay; ?></td>
<td><?php echo $licence; ?></td>
<td><?php echo $punit; ?></td>
<td><?php echo $value; ?></td>
<td><?php echo $operator; ?></td>
<td><?php echo $operator_id; ?></td>
<td>
<form action="approve.php" method="post">
<input type="hidden" name="delete_id" value="<?php echo $row['id']; ?>" />
<p><a href='approve.php?id=<?php echo $id; ?>'><button url="#" class="btn btn-primary">Approve</button></a></p>
</form>
<div id="reject-form" class="modal hide fade">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3><?php _e('Reject Reason'); ?></h3>
</div>
<div class="modal-body">
<div id="message"></div>
<form action="reject.php" method="post" name="rejectform" id="rejectform" class="form-stacked rejectform normal-label">
<div class="controlgroup rejectcenter">
<div class="control">
<input id="reject" name="reject" type="text"/>
</div>
</div>
<input type="hidden" name="delete_id" value="<?php echo $id; ?>" />
</form>
</div>
<div class="modal-footer">
<a href='reject.php?id=<?php echo $id; ?>'><button data-complete-text="<?php _e('Done'); ?>" class="btn btn-primary pull-right" id="rejectsubmit"><?php _e('Submit'); ?></button></a>
<p class="pull-left"><?php _e('Please give a short reason for rejecting.'); ?></p>
</div>
</div>
</form>
<p><a data-toggle="modal" href="#reject-form" id="rejectlink" tabindex=-1><button url="#" class="btn btn-primary">Reject</button></a></p>
</td>
</tr>
</table>
<?php
}
}
?>
</div>
<?php include ('footer.php'); ?>
任何帮助,将不胜感激!