PHP Help ... ("Location: logged_in.php")

Discussion in 'PHP' started by DonWar, Oct 23, 2008.

  1. #1
    Am making a mafia site and am codin the crew part ..

    I wont it to move to different pages by the database data.

    Am connected to the database.

    <?php
    if ($fetch->crew=="None")
    echo header("Location: logged_in.php")
    else echo " Well come to your crew.";
    ?>

    Can any body tell me why this isnt working?

    Daz.
     
    DonWar, Oct 23, 2008 IP
  2. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #2
    Don't echo the header("Location: logged_in.php")
    just header("Location: logged_in.php");
    Also, there can be no output to the browser before the header call is made.
     
    shallowink, Oct 23, 2008 IP
  3. Tom__

    Tom__ Peon

    Messages:
    148
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That's why alot of people use ob_start(); after <?php...
     
    Tom__, Oct 23, 2008 IP
  4. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #4
    And odds are he has HTML code prior to the start of the php code. But you can echo the header so that leaves the variable assignment. Check what its returning then go from there.
     
    shallowink, Oct 23, 2008 IP
  5. salahsoftware

    salahsoftware Peon

    Messages:
    63
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You are displaying the header instead of calling the header function. Don't echo it and pass the complete url including http:
     
    salahsoftware, Oct 23, 2008 IP
  6. DonWar

    DonWar Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Can any one right the code that will work?

    Sow i can learn them.
     
    DonWar, Oct 23, 2008 IP
  7. Kyosys

    Kyosys Peon

    Messages:
    226
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Actually, you don't need to pass the complete url. Just remove the echo


    <?php
    if ($fetch->crew=="None")
    header("Location: logged_in.php")
    else echo " Welcome to your crew.";
    ?>
     
    Kyosys, Oct 23, 2008 IP