PHP geeks - quick assist needed :)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Damian_Maxcash
    So Fucking Banned
    • Oct 2002
    • 12745

    #1

    PHP geeks - quick assist needed :)

    Why dosnt this work? - I get the dreaded 'Headers already sent' error.


    Code:
    <?php function comefrom()
    {
    $lang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
    if (substr($lang, 0, 2) hahahaha 'zh')
    {
    header("Location: http://asiafriendfinder.com/search/g462236-pct?race=2&show=F&age=18-27");
    } else {
    header("Location: home.php");
    }
    }
    
    comefrom();
    
    ?>
    Thanks
  • ssp
    Confirmed User
    • Jan 2005
    • 7990

    #2
    It probably means this piece of code is somewhere in the middle of your PHP code.. maybe even after something gets outputted (echo). Try moving it to the top.

    Comment

    • Damian_Maxcash
      So Fucking Banned
      • Oct 2002
      • 12745

      #3
      Its ok - I fixed it - I had a line before the function.

      Comment

      • ssp
        Confirmed User
        • Jan 2005
        • 7990

        #4
        Yep.. headers go first.

        Comment

        Working...