Hi,

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

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

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

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

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

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

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


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

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

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


KB> Kathleen


put this at the top of each page and see if you get any undefined
variables warnings as it may be a problem of variable scope

error_reporting(E_ALL);


-- 
regards,
Tom

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

Reply via email to