Re: [PHP] Session Varaible Problem

2002-03-22 Thread Randy Phillips


> 
> Are you calling session_start() on the subsequent pages you want to be
> part of the session?


No I was not. That was the problem. Thanks Rasmus.

-- 
Rp


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




Re: [PHP] Session Varaible Problem

2002-03-21 Thread Erik Price


Have you made sure that the correct values are even being loaded into 
the session variable containers?  IOW, try

echo $id;
echo $first_name;

to make sure that there is actually any value in those variables.



Erik


On Thursday, March 21, 2002, at 12:22  PM, Randy Phillips wrote:

> Hi,
>
> I have tried every example of creating a session variable I could find 
> on
> php.net and have had the same results with all of them. The session
> variables get set on the initial page but that's the only place I can 
> access
> them.
>
> I am new to php so I'm sure I have just overlooked something.
>
> Here is my latest attempt. It's a simple login page that starts a 
> session
> when a user successfully logs in:
>
> $connect...
>
> $sql ...
>
> list($id,$first_name) = mysql_fetch_row($sql);
> session_start();
> if (!session_is_registered('user_id')) {
> session_register('user_id');
> $user_id = $id;
> session_register('user_name');
> $user_name = $first_name;
> } else {
> echo "Session is set and should now be availalbe on all pages 
> via a
> cookie. At least that what I expected.";
> }
>
> Sadly, these vars are available only on this page.
>
> echo "ID: $user_id";
>
> echo "Name: $user_name";
>
> Mac OSX
> Apache
> PHP 4+
>
> Thanks,
>
> --
> Rp
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>







Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




Re: [PHP] Session Varaible Problem

2002-03-21 Thread Rasmus Lerdorf

Are you calling session_start() on the subsequent pages you want to be
part of the session?

On Thu, 21 Mar 2002, Randy Phillips wrote:

> Hi,
>
> I have tried every example of creating a session variable I could find on
> php.net and have had the same results with all of them. The session
> variables get set on the initial page but that's the only place I can access
> them.
>
> I am new to php so I'm sure I have just overlooked something.
>
> Here is my latest attempt. It's a simple login page that starts a session
> when a user successfully logs in:
>
> $connect...
>
> $sql ...
>
> list($id,$first_name) = mysql_fetch_row($sql);
> session_start();
> if (!session_is_registered('user_id')) {
> session_register('user_id');
> $user_id = $id;
> session_register('user_name');
> $user_name = $first_name;
> } else {
> echo "Session is set and should now be availalbe on all pages via a
> cookie. At least that what I expected.";
> }
>
> Sadly, these vars are available only on this page.
>
> echo "ID: $user_id";
>
> echo "Name: $user_name";
>
> Mac OSX
> Apache
> PHP 4+
>
> Thanks,
>
> --
> Rp
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




[PHP] Session Varaible Problem

2002-03-21 Thread Randy Phillips

Hi,

I have tried every example of creating a session variable I could find on
php.net and have had the same results with all of them. The session
variables get set on the initial page but that's the only place I can access
them.

I am new to php so I'm sure I have just overlooked something.

Here is my latest attempt. It's a simple login page that starts a session
when a user successfully logs in:

$connect...

$sql ...

list($id,$first_name) = mysql_fetch_row($sql);
session_start();
if (!session_is_registered('user_id')) {
session_register('user_id');
$user_id = $id;
session_register('user_name');
$user_name = $first_name;
} else {
echo "Session is set and should now be availalbe on all pages via a
cookie. At least that what I expected.";
}

Sadly, these vars are available only on this page.

echo "ID: $user_id";

echo "Name: $user_name";

Mac OSX
Apache
PHP 4+

Thanks,

-- 
Rp



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