我想从用户确认之前删除的条目确认之前删除
我呼吁单击删除功能
<li><img src="delete1.png" onClick="delete_records();" alt="delete_records" /></li>
的funcion保存在.js文件作为
function delete_records()
{
document.frm.action = "delete.php";
document.frm.submit();
}
的delete.php是如下
<?php require 'connections/connections.php'; ?>
<?php require 'includes/higherauth.php';// for user access level check
?>
<?php
// To stop accessing the page without login
if(isset($_SESSION["id"])){
}else{
header('Location: logIn.php');
}
?>
<?php
error_reporting(0);
$rado = $_POST['rado'];
$chkcount = count($rado);
if(!isset($rado))
{
?>
<script>
alert('At least one checkbox Must be Selected !!!');
window.location.href = 'account.php';
</script>
<?php
}
else
{
for($i=0; $i<$chkcount; $i++)
{
$del = $rado[$i];
$sql=$con->query("DELETE FROM mntr WHERE id=".$del);
}
if($sql)
{
?>
<script>
alert('<?php echo $chkcount; ?> Records Was Deleted !!!');
window.location.href='account.php';
</script>
<?php
}
else
{
?>
<script>
alert('Error while Deleting , TRY AGAIN');
window.location.href='account.php';
</script>
<?php
}
}
?>
请帮我添加一个警告确认删除
的可能的复制[如何显示一个确认消息之前删除?](HTTP ://stackoverflow.com/questions/9139075/how-to-show-a-confirm-message-before-delete) –