SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist Caesar's Avatar
    Join Date
    May 2000
    Location
    On some harddisk
    Posts
    599
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem registering variables for PHP4.10

    I'm currently running PHP 4.10 with register_globals = off.

    Code:
    <?php
    
    session_start();
    session_register("test");
    
    $test="3";
    ?>
    <a href=nextpage.php>Next</a>
    Code:
    //Nextpage.php
    
    <?php
    session_start();
    echo $_REQUEST[test];
    ?>
    can someone tell me how properly register my session variables such as test? I checked in the path that i specified for saving sessions and don't find a variable registered in the session file created.

    Please help!
    Go increase web site traffic by using 27 proven strategies!

  2. #2
    Are you ready for BSD? Marshall's Avatar
    Join Date
    Dec 2001
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can someone tell me how properly register my session variables such as test?
    See http://www.sitepointforums.com/showt...threadid=43599. It covers this topic and others.

    - Marshall

  3. #3
    Probably eating pie mitsubishi's Avatar
    Join Date
    Sep 2001
    Location
    England, UK
    Posts
    405
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your problem here is that you are using the wrong array
    $_REQUEST is an array containing what has come from the user, it is a combination of GET, POST and COOKIE. You wouldn't really want this anyway. The array you want is $_SESSION
    Also note that placing something in this array implicatley registers it into the session so,
    PHP Code:
    session_register("test");

    $test="3"
    is not neccessary, just use
    PHP Code:
    $_SESSION['test'] = 3
    *This is not the case for $HTTP_SESSION_VARS


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •