Hi I have a working link to delete a row from my database.
<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>");
}
?>
what I am looking to do is instead of having a link I want to have a button that when pressed it brings up a confirmation and then deletes the row if true.
I do not want accidental deletions.
<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>
GET
to delete things! All that will happen is a machine will come along and follow all the links and delete everything from your database! – SinesPOST
instead ofGET
– Ready