Ti suggerisco di iniziare leggendo questo articolo:

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