我有一个非常愚蠢的问题,我正在尝试解决。我制作了这个脚本来显示和删除数据库中的用户。但是我的警报功能不起作用。无论我在警报出现时按什么,它都会执行删除数据库中内容的操作。这是我的代码:
<?php include_once "includes/scripts.php"; ?>
<?php include_once "includes/connect.php";?>
<?php include_once "includes/cms_page_security.php";?>
<div id="cms_container"><br>
<br>
<h1>MANAGE USERS<img src="images/three_column_grid_line.png" alt="line"></h1>
<p class="logout_btn"><a href="admin_cms.php">Back</a></p>
<?php
$tbl="users";
$sql = "SELECT * FROM users";
$result = mysql_query($sql, $connect);
while($rows = mysql_fetch_array($result)){
echo $rows['user_name'];
echo ' ';
echo $rows['user_id']
?>
<a href="includes/delete_user.php?user_id=<?php echo $rows['user_id'] ?>" onClick="alertFunction()">delete</a>
<?php
} mysql_close();
?>
<script>
function alertFunction()
{
var r=confirm("Do you want to delete this user?");
if (r==true)
{
}
else
{
return (false);
}
}
</script>
</div><!--cms_container-->
</body>
</html>
当我按下取消时,我只想停止警报功能然后删除内容的过程。