Hi,

As I have no idea what those var contain ..
what does a print_r() of it give you?
print it right when you assign it to the session var to check if
it actually contains a value.

like:
print_r($Data['ID']);

and maybe even
print_r(intval($Data['ID']));

I suspect that this $Data['ID'] is empty from the start - otherwise
you ought to have something in your session var.

Richard


Monday, April 19, 2004, 12:46:02 AM, thus was written:
> Dear list,
> I am sorry for the second posting, but this is going
> to drive me to drink something other than lattes! 

> I have one page, index.php.  when it calls mod_sub, a
> directory type of page is printed.  Here I am trying
> to set a session var of the most recently selected
> category to allow the user to return the to same place
> in the directory.

> when I do this:
> $_SESSION['CategoryID'] = 230; in mod_sub

> then in mod_profile:
> print($_SESSION['CategoryID']);
> will print 230

> when I do this:
> $Tmp = 230;
> $_SESSION['CategoryID'] = $Tmp; in mod_sub

> in mod_profile:
> print($_SESSION['CategoryID']);
> will print 230

> BUT, when I do this:
> $_SESSION['CategoryID'] = $Data['ID']; in mod_sub
> $_SESSION['CategoryID'] = intval($Data['ID']);


> in mod_profile:
> print($_SESSION['CategoryID']);
> will print '' and 0

> I am setting several other session variables
> throughout the code without any unexpected behavior. 
> I have even tried changing the index to something odd
> in case I am resetting 'CategoryID' somewhere and
> forgotten it.  But no matter what I try, once I set it
> "= $Data['ID']" I get the odd result.

> BTW, if I print $_SESSION['CategoryID'] from mod_sub
> right after setting, it holds the expected value. 
> This is really frustrating, I must be missing
> something basic about the way session vars can be set.


> Kathleen

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

Reply via email to