Re: php session not persisting
| From: | Eric D. | Date: | Tue, 03 Jun 2003 21:00:45 +0000 |
| Subject: | Re: php session not persisting | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-150075@lists.php.net to get a copy of this message | ||
Thanks Kirk! I have all of the conditions you set out met. And still doesn't
work.
I also added session__is_registered("sess_var") to check and it tells me
that it's not registered.
1st script - page1.php:
<?
session_start();
session_register("sess_var");
$sess_var = "Hello world!";
echo "The content of \$sess_var is $sess_var<br>"; //echos fine here
?>
<a href = "page2.php">Next page</a>
2nd script - page2.php:
<?
session_start();
if (session_is_registered("sess_var"))
{ echo "true<br><br>";}
else
{echo "false<br>";}
echo "The content of \$sess_var is $sess_var<br>"; //$sess_var NOT printed
echo "sess_var = $_SESSION[sess_var]<br>";
session_unregister("sess_var");
?>
"Kirk Johnson" <kjohnson@zootweb.com> wrote in message
news:B11731D518B5D61183C700A0C98BE0D902587138@chef...
> > Thanks. I'm using PHP-4.3.1.
> >
> > The problem is not with $_SESSION. I used
> > session_is_registered("sess_var");
> > to check from the second script and cannot see the
> > variable("sess_var"). Can
> > anyone tell me why?
>
> Your code should work for register_globals "on". Check that:
>
> - php.ini is where it is supposed to be (/usr/local/lib/, I think).
> - register_globals is really to set to on in php.ini.
> - that cookies are enabled in your browser.
> - you don't have an .htaccess file in your directory with register_globals
> turned off in it.
>
> Kirk
>