in the file you sent, all of the code is double spaced, in other words that is causing there to be a blank line every other line, having the code be double spaced like will pretty much ensure that there is a blank line after every closing php tag "?>" and the next opening php tag "<?php" which will cause the headers already sent error.