Session Variable Question...
| From: | SBCSI) | Date: | Fri, 01 Nov 2002 20:50:52 +0000 |
| Subject: | Session Variable Question... | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-22905@lists.php.net to get a copy of this message | ||
I am a little confused by a specific behavior of a session variable.
Here is an example of my confusion:
<?php require_once('prod.lib.php');
session_start();
if (!isset($_SESSION['valid_user']))
{
echo "You must be logged in to use this application. <br>";
echo "Please <a href=\"login.php\"> login</a> now. <br>";
exit();
} else {
$sbcuid = $valid_user;
}
$_SESSION['type'] = $AccountType;
if (!isset($_SESSION['type']))
{
echo "You did not select an account creation option. <br>Please return to
the previous page and make a selection.";
}
echo "$_SESSION[type]";
echo "$type";
?>
OK... The basic question is that the first time the page loads only
the '$_SESSION[type]' variable is populated. If you hit the back button and
then reload this page, then both variables are populated even if the
$AccountType is changed on the previous page. I can now work around this
problem, but I would like to understand why it behaves this way.
Sorry if this is covered in the documentation or a FAQ somewhere.
Thanks in advance for the feedback.
Scott Nipp
Phone: (214) 858-1289
E-mail: sn4265@sbc.com
Web: http:\\ldsa.sbcld.sbc.com