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
[EMAIL PROTECTED]
m To: [EMAIL PROTECTED]
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