Posted by jkimball4 on 10/23/05 23:46
check your php.ini settings for sessions. if all seems to be okay then
make sure you are initializing sessions at the start of your php
scripts. like...session_start() or equivilent function. also check
how your sessions are being saved (on the server, cookies). if
cookies, check browser settings to make sure you are allowing cookies
to be saved on your machine.
typingcat@gmail.com wrote:
> Hello. I started writing PHP today.
> I added the following code at a php page.
> <?php
> if($_SESSION["dbpwd"]=="")
> {
> print("EMPTY!");
> $_SESSION["dbpwd"]="TEST";
> print(" SET TO ".$_SESSION["dbpwd"]);
> }
> else
> {
> print($_SESSION["dbpwd"]);
> }
> ?>
> I thought if I refreshed the page, then dbpwd would set to "TEST" and
> "TEST" would be displayed. But it didn't work. What's wrong? I'd like
> to keep some variables that only are good for the sessioin.
[Back to original message]
|