Forum Moderators: coopster
echo "<script type='text/javascript'> document.location = 'welcome.php'; </script>"; header("location: hotel-enter.php"); //wrong
header("location: /hotel-enter.php"); //wrong This code does work -->
echo "<script type='text/javascript'> document.location = 'welcome.php'; </script>";
however I am wondering if a browser has javascript disabled for whatever reason, this would not work?
Most contemporary clients accept relative URIs as argument to » Location:, but some older clients require an absolute URI including the scheme, hostname and absolute path.
Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include, or require, functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file.