[thelist] HELP! recongnize PHP session variables in frames

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


<disclaimer>
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
mix.
</disclaimer>

> 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">
> </FRAMESET>
>
> 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
loading
> 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
variables.

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

<FRAMESET COLS="73,*">
 <FRAME SRC="sidebar.html" NAME="sidebar">
 <FRAME SRC="main.php<? echo "?var1=$sessionvar1" ?>" NAME="main">
</FRAMESET>

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.



HTH,


--
mattwarden
mattwarden.com





More information about the thelist mailing list