Open a new php file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • S.Voll

    Open a new php file

    Hello everyone,

    I am confused. I want to open a php file and find myself redirected on
    another.

    a simple example of what I'd like to do.

    file1.php______ _______________ __

    <?php

    header(Location : http://127.0.0.1/file2.php);

    ?>

    file2.php______ ___________

    <?php

    echo "you are in file 2";

    ?>

    it doesn't work! maybe I am not using the proper function...

    what can I do?

    thanks for you help.


  • Colin McKinnon

    #2
    Re: Open a new php file

    S.Voll wrote:
    [color=blue]
    >
    > I am confused. I want to open a php file and find myself redirected on
    > another.[/color]
    <snip>[color=blue]
    >
    > <?php
    >
    > header(Location : http://127.0.0.1/file2.php);
    >[/color]

    You're missing some quotes around the function argument there

    header("Locatio n: http://127.0.0.1/file2.php");

    - if you're not seeing an error you should probably take the time to work
    out why not instead of asking hre every time it don't work too.

    C.

    Comment

    • The Numerator

      #3
      Re: Open a new php file

      You can also do this:

      file1.php:

      <?

      include "file.php";

      ?>


      and file2.php:

      <?

      echo "you are in file 2";

      ?>

      Comment

      Working...