1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to recover "header already sent"

Discussion in 'PHP' started by Katypeterson, Jan 3, 2014.

  1. #1
    Hi Friends...

    I have one doubt about ..How to recover "header already sent" error when same page contains two or more headers with if condition. Please gave some suggestion for me...

    Thanks & Regards

    Kiruthika.M
     
    Katypeterson, Jan 3, 2014 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    ob_start(); at the top of the page.
     
    PoPSiCLe, Jan 3, 2014 IP
  3. Juuh

    Juuh Member

    Messages:
    92
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #3
    There shouldn't be anything echoed before a header statement executes. In case it is not possible then you can call ob_start() in the start so output is buffered and not printed until the page execution is complete. This way nothing gets printed and header function works.
     
    Juuh, Jan 3, 2014 IP
  4. BeltHosting

    BeltHosting Greenhorn

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #4
    ob_start(); at the top of the page and in the between you could flush output buffer with: ob_flush();
     
    BeltHosting, Jan 5, 2014 IP