Ti suggerisco di leggere questo articolo:

Warning: Cannot modify header information - headers already sent ...