Hello All;Sounds like one server has registered globals on, and the other doesn't. Try changing your print statement like this:
Please forgive me if I am repeating an often asked question, but I am having
a problem with sessions. I simply cannot get them to work.
The sample code I provide works on another server perfectly, this is the
first page:
<?PHP
session_start();
session_register("name","pass");
$name = "hilde";
$pass = "mypassword";
echo "<h1>Session variables set!</h1>";
echo "<a href=\"page2.php\">go to next page</a>";
?>
When called, the following file arrives in /tmp:
sess_f9c5e87b35ae66eac64a9a346321b269
name|s:5:"hilde";pass|s:10:"mypassword";
So obviously the session file is being created.
However, when I go to page2.php?PHPSESSID=f9c5e87b35ae66eac64a9a346321b269
Which has this code:
<?PHP
session_start();
echo "<h1>The password of $name is $pass </h1>";
?>
I get "The Password of is "
As a response. Both pages work perfectly on another server, so I am having
trouble finding the problem, especially since the session file is actually
created in /tmp
My PHP.ini file is standard to a RedHat RPM install, but I will include it
as an attachment.
Any help would be greatly appreciated!
Mike Hillyer
print '<h1>The password of ' . $_SESSION['name'] is ' . $_SESSION['pass'] . '</h1>';
If you were displaying all errors and *warnings* (error_reporting (E_ALL)), it would have caught something like this.
--
sasha
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php