yes, use header("location: $url") before anything is output to the browser. If there is anything before the first php bracket <?, then that is included in "anything output to the browser". Any echo's, anything at all output to the browser before a header() is invalid. Perform all of your logic before you have to decide whether and where to send the user. Then use header(), or not if you want to continue processing the page. Also, don't forget to put an exit; after any header()'s.