Look familiar? This PHP error has haunted website owners for years. Please understand, HostGator does not normally support your webdesign and coding, but this error is too common for us to ignore. So, one of our PHP experts has the answer for you.
The problem you face is that you are trying to use the PHP header function, header(), but there can be absolutely no HTML output before this function is declared. Let's use some examples:
<html><body>
<?php header ('Location: http://hostgator.com/'); ?>
</body>
</html>
echo "Task complete.";
header ('Location: http://hostgator.com/');
?>
header ('Location: http://hostgator.com/');
?>
header ('Location: http://hostgator.com/');
?>
It is acceptable to have other PHP code before the header function, as long as nothing is outputted as HTML. This is a correct example:
$variable = "value";
mysql_query("blah blah");
header ('Location: http://hostgator.com/');
?>


