Help. I am missing a MAJOR aspect of using either Session variables or
global variables. I am trying to set one variable on one page, and read it
on the other _without_ sending any information in the query string. Here is
the code for the two pages :

test1.php :
<?php
 session_start();
 // Different methods of setting a SESSION variable :
 if (!isset($_SESSION["count"])) {
    $_SESSION["count"] = 0;
 } else {
    $_SESSION["count"]++;
 }
 echo $_SESSION["count"];

 session_register('var2');
 $var2="testing";

 // Trying to use a global variable
 global $help;
 $help = "howdy";

 $GLOBALS['help2']= "howdy again";

 print_r($GLOBALS);

?>
<a href="test2.php">step 2</a>

and test2.php looks like this:
<?php
 //$GLOBALS['help']= $_REQUEST['id'];
 print_r($_SESSION);
 print_r($GLOBALS);

 echo "COUNT=". $_SESSION["count"];

 echo "<HR>";
 echo "HELP=". $GLOBALS["help"];
 echo "HELP2=". $GLOBALS["help2"];
?>

On test2.php, each of the echo statements indicate that the variables have
not been defined. I've read many posts which indicate that I should pass the
PHPSESSID through the query string, but when I look at the PHPSESSID in the
global array printed it is the same on both pages. I cannot seem to have
access to either session nor global variables outside the context of one
page. Any assistance would be fascinatingly appreciated. Thanks...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to