Set your error reporting to E_ALL, to see if anything else is going on.

Add this line right after session_start() in both files, to make sure the
session ID is getting passed correctly. The same ID should be displayed in
both files:

echo "ID = " . session_id() . "<BR>";


> -----Original Message-----
> From: Eric D. [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 03, 2003 3:01 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] php session not persisting
> 
> 
> 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" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > > 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to