-1

i want to redirect from my feedback form to main html file after clicking on alert message which prompts after getting the feedback

i used the code given below

<?php 
echo '<script language="javascript">';
echo 'alert("Thankyou for your feedback.");';
echo 'window.location.href="file:///C:/xampp/htdocs/project/main.html";';
echo '</script>';
  ?>

there is a blank white screen after i click on ok(alert message) this is my contactindex.php file above

  • Possible duplicate of [How do I make a redirect in PHP?](https://stackoverflow.com/questions/768431/how-do-i-make-a-redirect-in-php) – Ingus Apr 10 '19 at 08:46
  • 1
    You cannot and don't want redirect to a file on your harddisk. It has to be a URL on the net - likely `"/main.html"` – mplungjan Apr 10 '19 at 08:53
  • Since you appear to be using xampp, why are you then using a `file://` URL??? You've installed a http webserver, so use it. – ADyson Apr 10 '19 at 08:54
  • _This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers._ – mplungjan Apr 10 '19 at 08:57

1 Answers1

0

Use this:

<?php 
    echo '<script>';
    echo 'alert("Thank you for your feedback.");';
    echo 'window.location="/main.html";';
    echo '</script>';
?>
encodeslife
  • 123
  • 7