Reputation: 38
I want to delete a row in mysql database by Javascript confirmation box.
<?php
$select_items= mysql_query("SELECT * FROM items");
$row_select_items= mysql_fetch_array($select_items)
extract($row_select_items);
$db_item_id=$row_select_items['db_item_id'];
echo "<a href=\"index.php?type=delete&value=$db_item_id\">Delete</a>";
?>
As soon as user click on "Delete" link, I want to get a javascript confirm box to confirm the deletion. If it yes delete the row with certain id, if it no just close the pop up box.
Upvotes: 0
Views: 47
Reputation: 5560
In the link you can add:
"<a href=\"index.php?type=delete&value=$db_item_id\" onclick=\"return confirm('Are you sure?');\">Delete</a>";
Upvotes: 2