Re: SESSION newbie question
| From: | Richard Lynch | Date: | Wed, 03 Jul 2002 03:40:17 +0000 |
| Subject: | Re: SESSION newbie question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-105123@lists.php.net to get a copy of this message | ||
>www.net.co.cr/test/test.php
<?
if ($QUERY_STRING == "")
{
session_start();
$_SESSION['tree'] = "green";
Change the line above to these two lines:
session_register('tree');
$tree = 'green';
Think of $_SESSION (and the other $_XXX vars) as "read-only"
Use session_register() to say which variables should "live long and prosper"
and then just use them like regular variables.
echo '<HTML>
<HEAD>
<TITLE>frame session test</TITLE>
</HEAD>
<FRAMESET cols="165,*" border=0 frameborder=0 framespacing=0">
<FRAME SRC="?1.html" name="mainMenu" MARGINWIDTH="0"
MARGINHEIGHT="0"
border=0 frameborder=0 FRAMESPACING="0" NORESIZE SCROLLING="no">
<FRAME SRC="?2.html" name="right" MARGINWIDTH="0"
WIDTH="0" border=0
frameborder=0 FRAMESPACING="0">
</FRAMESET>
</HTML>'; }
if ($QUERY_STRING == "1.html")
{ echo "<b>This is just a dummy frame.</b>"; }
if ($QUERY_STRING == "2.html")
{
echo "<b>";
echo "The value of \$_SESSION['tree'] is:";
echo gettype($_SESSION['tree']);
echo "</b>";
}
?>
--
Like Music? http://l-i-e.com/artists.htm