嗨,我有一个工作链接可以从我的数据库中删除一行。
<a href="?action=delete&id=<? echo $id ?>" onclick="return confirm('Are you sure you want to delete?')"><strong>Delete this Case</strong></a></td>
<?php
if($_POST['action']=="delete")
{
$id = $_POST['id'];
mysql_query("DELETE FROM rmstable2 WHERE id= '$id'");
echo("> Case # $id has been deleted as requested. To see your changes please click <a href='/martinupdate.php?id=$id'>here</a></b><br>");
}
?>
我想要做的不是有一个链接,而是我想要一个按钮,当按下它时会显示一个确认,然后如果为真则删除该行。
我不希望意外删除。
<form>
<input type="button" value="Delete this Case" onclick="return confirm('Are you sure you want to delete?')";
<a href="?action=delete&id=<? echo $id ?>">
</form>