我正在尝试通过页面传递 ID。我正在使用表格,每一行都有一个按钮有一个 ID,但是当我传递它时,它只将最后一个 ID 输入到数据库中,它看不到我点击的内容
第一页传入的代码
<?php foreach($prob_list as $row){?>
<tr>
<th>
<label><?php echo $row['name']; ?></label>
</th>
<td>
<label><?php echo $row['extno']; ?></label>
</td>
<td>
<label><?php echo $row['department']; ?></label>
</td>
<td>
<label><?php echo $row['problem']; ?></label>
<label><?php echo $row['program']; ?></label>
<label><?php echo $row['another'];?></label>
</td>
<td>
<input type="hidden" name="status" id="status" value="<?php echo $row['ID']; ?>"/>
<input type="submit" class="done" name="done" value="Done">
</td>
</tr>
另一个页面的代码
if (isset($_GET['status'])) {
$id = $_GET['status'];
$query = "SELECT * FROM problems WHERE ID =$id";
$result = mysqli_query($con, $query);
$prob_list = array();
while ($row = mysqli_fetch_assoc($result)) {
$prob_list[$row['ID']] = array(
'ID' => $row['ID'],
'name' => $row['name'],
'extno' => $row['extno'],
'department' => $row['department'],
'problem' => $row['problem'],
'program' => $row['program'],
'another' => $row['another']
);
}
}
杨__羊羊