Don't send any content to the browser before you send the header("Location:target"). If you do, that will be the page the browser receives, not the one you're trying to redirect them to.
Blank lines count as content.
[This question has been asked on this forum 784 times]