点击此链接,我需要一个确认框。如果我单击是,它应该移动到给定的地址;否则它应该保留在同一页面中。
此代码位于我的glossaryindex.php
:
echo '<td><a href="deleteingredient.php?id=' . mysql_result($result, $i, 'id') . '">Delete</a></td>';
我的deleteingredient.php
中的此代码:
if (isset($_GET['id']) && is_numeric($_GET['id']))
{
// get id value
$id = $_GET['id'];
// delete the entry
$result = mysql_query("DELETE FROM ingredient_details WHERE id=$id")
or die(mysql_error());
// redirect back to the view page
header("Location: glossaryindex.php");
}
else
// if id isn't set, or isn't valid, redirect back to view page
{
header("Location: glossaryindex.php");
}