RE: [PHP] Session confusion again :( - Thanks!

From: Date: Wed, 14 Apr 2004 16:46:54 +0000
Subject: RE: [PHP] Session confusion again :( - Thanks!
Groups: php.general 
Request: Send a blank email to php-general+get-183352@lists.php.net to get a copy of this message
On 14 April 2004 17:40, BOOT wrote: > Any help with this would be appreciated. the p and v lnames are > posted from a form. In the form, the user seperates last names with a > "/". What I can't understand is why Test1 shows as nothing, while > Test2 shows the value I wanted. Thanks a lot! > > > $p_lnames= explode("/", $p_lnames); > > > $_SESSION['element_countp'] = count($p_lnames); > > > echo "TEST 1".$element_countp; Because here, you haven't assigned anything to $element_countp -- you've only assigned it to $_SESSION['element_countp']. (With register_globals Off, the two are not the same.) If you turned your error_reporting level up to E_ALL, you'd probably get a warning at this point saying that $element_countp is undefined. > > > $element_countp = $_SESSION['element_countp']; > > > echo "TEST 2".$element_countp; Now you've assigned a value to $register_countp, so you get it output. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.ford@leedsmet.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.general (#183352) next »