我想只更新檢查表中的行,但什麼也沒有發生 這裏是我的代碼更新檢查行PHP的MySQL
<?php
//database connect select
$result=mysql_query("Select * from ticket_reservation WHERE
validate_status='No'") or die(mysql_error());
while($row=mysql_fetch_array($result))
{
echo "<tr><td><input type='checkbox' id='name' name='name[]'value=".$row['id']."</td><td>".$row['userid']."</td> <td>".$row['busid']."</td><td>".$row['numberofseats']."</td></tr>";
echo "<br>";
}
echo"<tr><td><input type='submit' name='submit' Value='Validate Tickets'> </td></tr>";
if(isset($_POST['submit']))
{
if(is_array($_POST['name']))
{
$qry = "UPDATE ticket_reservation SET validate_status='Yes' WHERE id IN (".implode(',', $_POST['name']).")";
// echo $qry; // For checking the generated sql statement; can be removed
mysql_query($qry);
}
}
?>
</table>
</form>
你錯過這裏下劃線'$ POST' –