how to make session work
| From: | myfeng at netzero dot com | Date: | Tue, 16 Dec 2003 22:36:33 +0000 |
| Subject: | how to make session work | ||
| Groups: | php.install | ||
| Request: | Send a blank email to php-install+get-12393@lists.php.net to get a copy of this message | ||
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