paul's idea is the best (only?) way. However, if you do something like this:
print "foo";
header("Location: someotherpage.php");
php will become very upset. Calling print will automatically send a text/html header to the browser, so when you try to send a second header with the header() call, things get ugly. The best way to get around this is to buffer your php output (ie store it in server ram until ALL php parsing and execution is done, then send it) that way, a header() call will override implicit text/html headers. make sense?
This is done by calling ob_start() at the beginning of your page (start buffering) and ob_end_flush() at the very end of your page. It's a good practice to get into and will save you headaches in the future.