Thanks to Julie and Stuart for helping me.
With your direction, I got rid of the warning about the headers by putting
the session_start() at the beginning of the file.
Now I get a different sort of error when I try to retrive the session variable:
-------------------------------
Warning: Undefined index: node in c:\program files\apache
group\apache\htdocs\wan\getglobal.php on line 17
-------------------------------
Any ideas why?
(Here's the exact code I've got)
[sessions.php]
<?php session_start();?>
<html>
<head>
<title>A test</title>
</head>
<body>
<?php
function sessionSetNode ($node_id) {
return ($_SESSION['node'] = $node_id);
}
sessionSetNode("10.2");
?>
</body>
</html>
[getglobal.php]
<?php session_start();?>
<html>
<head>
<title>A test</title>
</head>
<body>
<?php
if (!empty($_SESSION)) {
extract($_SESSION);
} else if (!empty($HTTP_SESSION_VARS)) {
extract($HTTP_SESSION_VARS);
}
function sessionGetNode () {
return $_SESSION['node'];
}
$n = sessionGetNode();
echo ("Node is $n.");
?>
</body>
</html>
TIA,
Leston
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php