我想在重定向到另一个页面之前显示一个警告框,这是我的代码。当我删除头部函数时,它可以正常工作,但当它存在时,它只会重定向到页面而不显示警告框。
<html>
<body>
<?php
include("dbconfig.php");
$tempid = mysqli_real_escape_string($dbconfig, $_POST['tempid']);
$sql_query = "DELETE FROM Visits
WHERE visitid = '$tempid'";
$result = Mysqli_query($dbconfig, $sql_query);
if ($result) {
echo '<script language="javascript">';
echo 'alert("visit deleted successfully")';
echo '</script>';
header("location:../SearchCountry/search.php");
}
?>
</body>
</html>