我正在尝试更新表格(账单),字段(选中),如果用户选中复选框,则字段(选中)将为1
第1页:detail.php
while($row = mysql_fetch_array($results))
{
$ch=$row['checked'] ;
$idw=$row['key'];
}
然后我检查用户之前是否检查过这一行,如果没有,我发送 key&checked 以执行检查过程:
if ($ch==1)
{
echo "this record has been checked";
}
else
{
echo "<form action=\"checked.php\" method=\"GET\" enctype=\"multipart/form-data\" >";
echo "<input type=\"hidden\" name=\"ids\" value=\"$idw\" ><br>";
echo "<input type=\"checkbox\" name=\"check\" value=\"checked\" ><br>";
echo "<p><input name=\"submit\" type=\"submit\" value=\"submit\" /></p>";
echo "</form>";
}
page2:checked.php
$idw=$_GET['ids'];
$check=$_GET['check'];
$sql="UPDATE bill SET checked=1 where key=$idw";
$results=mysql_query($sql);
if ($results)
{
echo "the record has been updated successfully";
}
更新失效了,求大神帮忙