<form action="" method="post">
<?php
include 'Includes/database_connection.php';
$sql = "select * FROM sims" ;
$result = mysql_query($sql,$con);
while($row = mysql_fetch_assoc($result)){
?>
<ul class="category_list">
<input type="hidden" value="$id1" name="hidden">
<li><a href="#"><?php echo $row['phonenr'];?><input type="hidden" value="<?php echo $row['id'];?>" name="id"></a></li>
</ul>
<?php
}
?>
<input type="submit" name="submit">
</form>
所以我得到了上面的表格,您可以在其中选择电话号码,当您提交它们时,应该更新数据库。里面有23个id。提交表单后,它总是取最后一个值。我究竟做错了什么?
if(@$_POST ['submit'])
{
$id = $_POST["id"];
echo $id;
include 'Includes/database_connection.php';
mysql_query("UPDATE pairings SET sim_id='$id'
WHERE unit_id='$id1'")
}