[thelist] HELP! recongnize PHP session variables in frames

Warden, Matt mwarden at odyssey-design.com
Sat Feb 17 15:19:33 CST 2001

I know very little about PHP sessions. What I'm offering is information on the
usual implementation of sessions and adding a bit of common sense into the

> If I have the frames listed below in a file called framepage.php:
> <FRAMESET COLS="73,*">
>  <FRAME SRC="sidebar.html" NAME="sidebar">
>  <FRAME SRC="main.php" NAME="main">
> How can I send a session variable to main.php instead of just the entire
> framepage.php??
> I am using php session variables for a login session, so framepage.php is
> up, but the main frame section called main.php needs to call theses
variables also
> to perform different tasks depending on the user logged in.

The basic idea of sessions is to "link" a set of requests to a single user. If
a user makes two HTTP requests, the server doesn't know whether those requests
came from two different users or the same user. With sessions, this
information is available (as long as cookies are enabled or some other method
is used (like passing the sessionid in the querystring)). So, then it doesn't
make sense that framepage.php would have session variables available and
main.php (or sidebar.php for that matter).

Have you varified that you can print out the session variables in
framepage.php? If you can't, there's a problem with sessions, not passing the

If, in fact, there is some unique issue with PHP sessions, you can always do

 <FRAME SRC="sidebar.html" NAME="sidebar">
 <FRAME SRC="main.php<? echo "?var1=$sessionvar1" ?>" NAME="main">

and it will be available to main.php as $var1 and $HTTP_GET_VARS['var1']

But, like I said, you shouldn't have to do that.



More information about the thelist mailing list