我想從用戶確認之前刪除的條目確認之前刪除
我呼籲單擊刪除功能
<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) –