Re[2]: [PHP] sessions help
| From: | Leston Drake | Date: | Thu, 13 Jun 2002 21:32:25 +0000 |
| Subject: | Re[2]: [PHP] sessions help | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-102074@lists.php.net to get a copy of this message | ||
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