Passing REFERENCE SESSION variables (session number, etc) INTO Frameset

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LOVEnCompany
    New Member
    • Dec 2011
    • 1

    Passing REFERENCE SESSION variables (session number, etc) INTO Frameset

    I have found I CAN pass variables into FRAMESETS via PHP and SESSION VARIABLES, by doing the following:

    in the first file:
    Code:
    $varname = "variable in question";
    $_SESSION['varname'] = $varname;
    $substitute_name = $_SESSION['varname'];
    IN the FRAMESET:
    Code:
    <?php
    session_start();
    $_SESSION['varname'] = $substitute_name;
    echo "<html>\n";
    echo "<FRAMESET cols=200,*>\n";
    echo "<FRAME NAME=FRAME1 SRC=/frame1.php></frame>\n";
    echo "<FRAME NAME=FRAME2 SRC=/frame2.php></frame>\n";
    echo "</frameset>\n";
    echo "</html>\n";
    ?>
    By setting the VARNAME FROM the SUBSITUTED NAME prevents them from interacting and freezing the access, and re-establishes the varname. Do it PRIOR to the HTML declaration, though and it carries into ALL frames.

    HOWEVER... you cannot CHANGE it INSIDE a frame, to pass it back, because multiple frames have their OWN instance and changing one does NOT change the other OR the master copy. This only allows establishing PERMANENT REFERENCE variables and passing them INTO the frame.

    You MIGHT want to do
    Code:
    $_SESSION['substitute_name'] = $varname;
    as well in the initial declaration just to be sure it gets into the session variables.

    Note BOTH files MUST be done with
    Code:
    <?php
    session_start();
    
    pre-declared, ending in
    
    ?>
    Which just goes without saying.
    Last edited by Niheel; Dec 18 '11, 12:55 AM. Reason: merge into one article/insigh
Working...