Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

session variables

Status
Not open for further replies.

bardley

Programmer
May 8, 2001
121
US
Hello. I am trying to maintain a session by setting a cookie. I would like to be able to share variables between different .php scripts. The intuitive way to do this seems to be:

session_start();
session_register("my_var");
$my_var = 5;

How do I access $my_var from another .php script (in a different file)? I don't want to include SID in the url, and I can't seem to get another script to recognize the variable from the first script.

Many thanks for any assistance.
Brad Gunsalus
Cymtec Systems, Inc.
bgunsalus@cymtec.com
 
<?session_start();?>

Just put that at the top of a script, and then you can reference the session variables.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top