Help seeing Session vars from Include scipts

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

    Help seeing Session vars from Include scipts

    I am new to php and need some help getting the session variables into
    include files. (after-thought, Sorry for the drawn out post but I
    really, really need help....;)

    Here's what I'm doing..

    I have a php request_form that I use 2 different ways: by itself (url
    directly to the form) and as an include to be displayed in existing
    php pages. This form uses POST to another php_script that performs
    serverside validation and db write. If all go's well then a write to a
    mySQL table and a redirect to a confirm page. I have been using this
    form for months and it works great.

    Here's what I'm having trouble with..(I'm now 'trying' to use Sessions
    and query strings)

    I am using _GET to retrieve query-string vars to set as _SESSION vars
    to eventually be written to the db with the form data. When I use the
    form by itself (direct url), everything works like a charm! The
    session vars are available to the serverside script and are written
    the db. If I use it as an include in an existing page, neither the
    form or the serverside script can access the session vars, although
    the 'existing page' and the confirm page can!

    The session vars are there through out the whole process because the
    confirm page is the last step and the session vars are there and
    available. Why can't I use see the session vars when the form is used
    as an include??

    Any help or direction would be GREATLY appreciated. I have searched
    and the boards for hours with no luck.

    James

    Setup:
    FreeBSD 4.4
    PHP 4.3.0
    Register Globals - off
    session.auto_st art - off
    session.save_ha ndler - files
    session.use_coo kies - on
    session.use_tra ns_sid - on

    Code (when using form as an include absolute url is used with
    require())
    /////////////////////////////////////////////////////////////////////
    Top of 'an existing' php page:
    <?php
    session_start() ;
    $_SESSION['session_cmpid'] = $_GET['cmpid'];
    $_SESSION['session_engid'] = $_GET['engid'];
    $_SESSION['session_kwid'] = $_GET['kwid'];

    $campaign=$_SES SION['session_cmpid']; 'I placed this here as a test.
    echo 'Campaign is '.$campaign;
    ?>
    ///////////////////////////////////////////////////////////////////////
    Top of form script:
    <?php
    session_start() ;
    $_SESSION['session_cmpid'] = $_GET['cmpid'];
    $_SESSION['session_engid'] = $_GET['engid'];
    $_SESSION['session_kwid'] = $_GET['kwid'];

    $campaign=$_SES SION['session_cmpid']; 'I placed this here as a test.
    echo 'Campaign is '.$campaign;
    ?>
    //////////////////////////////////////////////////////////////////////
    Top of serverside script:
    <?php
    session_start() ;
    if (!isset($_SESSI ON['session_cmpid']))
    {
    $campaign="100" ; //Internet Request
    }
    else
    {
    $campaign=$_SES SION['session_cmpid']; //Session Campaign
    }

    $engid=$_SESSIO N['session_engid'];
    $kwid=$_SESSION['session_kwid'];
    //////////////////////////////////////////////////////////////////////
    Top of confirm page:
    <?php
    session_start() ;
    $campaign=$_SES SION['session_cmpid']; 'I placed this here as a test.
    echo 'Campaign is '.$campaign;
    ////////////////////////////////////////////////////////////////////
Working...