Hello all,
I have a problem with my session variables
Here is the first script which defines the variables.
test1.php
<?php
session_start();
?>
<html>
<head>
<title>Test 1</title>
</head>
<body>
<?php
session_register ( "product1" );
session_register ( "product2" );
$product1 = "Sonic Screwdriver";
$product2 = "Hal 2000";
print session_encode();
print "The products have been registered\n\n";
?>
</body>
</html>
And here is the second script that calls the variables.
test2.php
<?php
session_start();
?>
<html>
<head>
<title>Test2</title>
</head>
<body>
<?php
print "Your chosen products are: \n\n";
print "<ul><li>$product1\n<li>$product2\n</ul>\n";
?>
</body>
</html>
When I use print session_encode() in test2.php it prints out just like in test1.php.
But in test2.php I get
Your chosen products are:
Notice: Undefined variable: product1 in C:\Xitami\webpages\tracy\test2.php on line 11
Notice: Undefined variable: product2 in C:\Xitami\webpages\tracy\test2.php on line 11
I don't know why this is happening.
I am using the Xitami webserver on Windows XP with PHP4.
Any help would really be appreciated.
Thanks,
D.