创建指向html幻灯片的php重定向

创建指向html幻灯片的php重定向,php,html,Php,Html,您好,我正在尝试创建一个php语句,它会将您重定向回另一个页面上我的html幻灯片上的一组幻灯片。但是,尽管数据插入到我的数据库中,但它不会重定向回html页面上的幻灯片 我已经尝试过使用html锚定品脱,但它们不起作用 我的php文件 <?php $url = 'Details.html'; $anchor = 'slide3'; if(mysqli_query($con,$sql)){ echo 'Request Submitted'; echo<<&l

您好,我正在尝试创建一个php语句,它会将您重定向回另一个页面上我的html幻灯片上的一组幻灯片。但是,尽管数据插入到我的数据库中,但它不会重定向回html页面上的幻灯片

我已经尝试过使用html锚定品脱,但它们不起作用

我的php文件

<?php

$url = 'Details.html';
$anchor = 'slide3';

if(mysqli_query($con,$sql)){
    echo 'Request Submitted';
    echo<<<JS
<script type="text/javascript">
   document.location.href="$url?$query_string#$anchor";
</script>
JS; 
} else {
    die("Error: " . mysqli_error($con));
}
?>
我想把它和幻灯片联系起来

<div class="mySlides w3-container w3-blue" id="slide3">
<h1 class="w3-wide w3-center"><b>BUSINESS DETAILS</b></h1>
<div class="w3-center w3-container w3-content w3-padding-16">
<form action="Addition.php" method="post">
      Business Name : <input type="text" name="bname">
              <br>
              <br>
      Business Type : <input type="text" name="btype">
              <br>
              <br>
              <button class="w3-button w3-green" 
  onclick="plusDivs(1)">Submit and Continue</button>
 </form>
 </div>
</div>

除非有充分的理由,否则不要混合使用PHP和JS。使用标题'Location:name_of_file.html';最后退出;要么死;重定向

<?php

$url = 'Details.html#slide3';

if (...){
    header('Location: ' . $url); 
    exit;
}

除非有充分的理由,否则不要混合使用PHP和JS。使用标题'Location:name_of_file.html';出口重定向。如果mysqli_query$con,$sql{其中定义了$sql和$con。或者为什么要运行一个看起来没有实际使用的查询?$query_字符串从何而来??