I have a basic form, which on selecting the submit button I'm trying redirect to another page:
<body>
<?php
include "dataconn.php";
if (isset($_POST['submit_']))
{
            
    $name = $_POST['name'];
    $company = $_POST['company'];
    $host = $_POST['host'];
    $date = $_POST['date'];
  
    $insert = mysqli_query($con,"INSERT INTO `visitorinfo`(`name`, `company`, `host`,`dateOfVisit`) VALUES ('$name','$company', '$host', '$date')");
    
} 
mysqli_close($con);
?>
                                                                 
<form target="_blank" method="POST" action="finalpage.htm">
 <label for="name" style="display:block">Name </label> 
 <input type="text" id="name" name="name"> 
 <label for="company" style="display:block">Company</label> 
 <input type="text" id="Company" name="company">
 <label for="host" style="display:block">Name of Host</label> 
 <input type="text" id="host" name="host"> 
<span style="display:inline-block">
 <label for="date" style="display:block">Date of visit</label> 
 <input type="date" id="date" name="date"> </span>
<input onclick="window.location.href = 'finalpage.htm';" type="submit" name="submit "value="submit"/>
 
</form>
</body>
</html>
This correctly takes me to the next page, however the data of the form is not getting saved to my database? I've tried using <a> tags but this doesn't redirect to the page at all.
Also the page that it gets redirected to has a countdown timer so it automatically redirects to another page but the JavaScript doesn't seem to work when it lands on this page after form submission
<head>
<script>
var timeleft = 10;
var downloadTimer = setInterval(function(){
  timeleft -= 1;
  if(timeleft <= 0){
    clearInterval(downloadTimer);
    window.location='file:///C:/wamp64/www/welcomepage.htm';
  }
}, 1000);
</script>
<head>
 
     
    