That is because you have an output:
results in blank line output.
header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP
Combine all your PHP codes and make sure you don't have any spaces at the beginning of the file.
header('location: index.php'); add
exit(); if you have any other scripts bellow.
Also move your redirect header after the last
<?php echo "<script>window.location.href='target.php';</script>"; exit; ?>
~ Answered on 2012-09-21 06:24:06