Sending variables from one file to another.

Discussion in 'PHP' started by Skinny, Apr 3, 2007.

  1. #1
    How do I do this?

    Let's say I have a variable called $url that is defined in the first file.

    I now want to use that variable in the second file.

    How can I send that variable from one file to the other?

    Skinny
     
    Skinny, Apr 3, 2007 IP
  2. crazyryan

    crazyryan Well-Known Member

    Messages:
    3,087
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    175
    #2
    You could put your variables in vars.php, and then

    include("vars.php");

    At the top of every page you want the variables in.
     
    crazyryan, Apr 3, 2007 IP
  3. lbalance

    lbalance Peon

    Messages:
    381
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #3
    you could save the variables as Session variables
     
    lbalance, Apr 3, 2007 IP