Re: how to make session work

From: Date: Tue, 16 Dec 2003 22:48:31 +0000
Subject: Re: how to make session work
Groups: php.install 
Request: Send a blank email to php-install+get-12394@lists.php.net to get a copy of this message
hmmmm. this actually works fine for me on windows and linux. Both with PHP4.33 and Apache1.39. this is extreamly minor and should not matter, but, the first has ' around the array index ($_SESSION['product1'] ) the second, does not ($_SESSION[product1]). This may not make a bit of a difference, but its worth a shot.... I'd also try var_dump($_SESSION); in the second script to see that the $_SESSION array contains hth Jeff myfeng@netzero.co m To: php-install@lists.php.net cc: 12/16/2003 05:36 Subject: [PHP-INSTALL] how to make session work PM Dear all, I have problem use session on windows. Here is two php scrip I test: 1) <?php session_start(); ?> <html> <head> <title>Listing 16.2 Storing variables in a session</title> </head> <body> <?php $_SESSION['product1'] = "Sonic Screwdriver"; $_SESSION['product2'] = "HAL 2000"; print "The products have been registered."; ?> </body> </html> 2) <?php session_start(); ?> <html> <head> <title>Listing 16.3 Accessing stored session variables</title> </head> <body> <?php print "Your chosen products are:\n\n"; print "<ul><li>$_SESSION[product1]\n<li>$_SESSION[product2]\n</ul>\n"; ?> </body> </html> First, I run script one, then script two, but it doesn't print any global value. It seems the session was not working. Do I need to configure the php.ini and how? thank you! Henry

« previous php.install (#12394) next »