Pardon my ignorance, I've been searching for answers for this new $_SESSION to work to 
no avail. If someone can help me out by giving examples how I can pass the session_id 
to the next page and access the same $_SESSION["var"] on that page, it would be very 
helpful. 

My question is, once I set this on the 1st page: 
<? 
session_start(); 
if (!isset($_SESSION["foo"])) { 
$_SESSION["foo"] = "test foo"; 
} 

?> 
<body> 
<? echo $_SESSION["foo"] . "<br>"; 
echo session_id() . "<br>"; 

echo "<br><br>"; 
?> 
<a href="reg_2.php?id="<? session_id(); ?>">reg_2.php</a> 
</body> 


How do I set up link to the next page, and what should I put on the next page? Will 
this be correct? 

<? 
session_id($_GET["PHPSESSID"]); 
session_start(); 
?> 
<body> 
<? print $_SESSION["foo"]."<br>"; ?> 
</body> 


But I got this error message: 

Warning: Undefined index: foo in c:\phps\reg_2.php on line 6 

I'm new to PHP so this is also a major factor of the failure. Again, thanks for your 
help. 



Burhan 


greg wrote: 
------------------------------- 
Use of $_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended for 
security and code readablity. With $_SESSION or $HTTP_SESSION_VARS, there is no need 
to use session_register()/session_unregister()/session_is_registered() functions. 
Users can access session variable like a normal variable. 

http://www.php.net/manual/en/ref.session.php

Reply via email to