This is a common problem that people make when working with PHP's header() function. In a nutshell what the error is telling you, is that you can not redirect because your PHP script has already sent HTML to the browser.
The long explanation is this: When a browser request your script from the server, it sends the request in a header, like this:
GET /index.php HTTP/1.1
And the server responds with something like this:
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Followed by the document's HTML. Once the HTML has started flowing to the browser, *no more headers* can be sent. Now PHP's header() function simply does this:
HTTP/1.1 302 OK
When the browser gets this response, it redirects to the "location" URL instead. PHP's header() function simply inserts "Location: http://www.myothersite.com" into the response header. But like I said above, once HTML has started flowing to the browser, you can't send any more headers.
Use of the header() function has to be before *anything* is output in your script. No text, no HTML, not even a single space.