There are a few things that could cause this, such as misplaced white space somewhere (like at the beginning or end of the file) or any html before any headers are sent. You can enable output buffering to get rid of the error: Place this at the beginning of your page:
<? ob_start(); ?>
and this at the end of your page:
<? ob_flush(); ?>