access the variable from one file to third file

Discussion in 'Web Design, HTML And CSS' started by deepakagrawal, Apr 17, 2007.

  1. deepakagrawal

    deepakagrawal New Member

    Joined:
    Apr 13, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    hi,
    i have to access the variable from below file (var:- query1)
    **************************************************************
    Code:
    <?php
    session_start();
    ?>
    <form method=post action='frame0.php'>
    <b> Enter the Query:</b>
    <input type="text" name="query1" size=50 />
    <br>
    <input type=submit name=submit value="Sign!">
    <input type=reset name=reset value="Start Over">
    <?php
    $_SESSION["views"]="$query1";
    ?>
    </form>
    
    *****************************************************************
    To below file
    ********************************************************
    <html>
    <?php
    session_start();
    include 'config.php';
    $roll = 'CREATE DATABASE ids';
     mysql_select_db('ids')or die('Cannot select database');
    //$call = $_POST["query1"];
    $call = $_SESSION["views"];
    $result = mysql_query($call);
    while($row = mysql_fetch_array($result))
    {
    echo "<b>FirstName:</b>";
    echo $row["Name"];
    echo "<br>\n";
    echo "<b>Age:</b>";
    echo $row["Age"];
    echo "<br>\n";
    echo "<b>Location:</b>";
    echo $row["Location"];
    echo "<br>\n";
    };
    include 'closedb.php';
    ?>
    </html>
    *****************************************************************
    but i am trying to access that variable but it is not access.
    so ples tell me how can i access that variable .....
     
    Last edited by a moderator: Apr 17, 2007
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    I see that $query1 is not defined in the first PHP file.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice