Problem Passing Session Variables.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

waskelton4 wrote:also.. to clarify what just happened....

Code: Select all

<?php 
session_start(); 
session_register('test'); 
session_register('test2'); 

$test = 1; 
$test2 = 'foo'; 
?>
this code creates two variables $test and $test2 and puts them in an array called $HTTP_SESSION_VARS....

correct?
Pretty much - session_register() registers the named variables (whether they exist at the time of registration or not) as a session variable so by virtue of that they end up in the $HTTP_SESSION_VARS array. If you do the session_register() stuff at the top of the page then it's easier to remember what you have put in $HTTP_SESSION_VARS.

Mac
waskelton4
Forum Contributor
Posts: 132
Joined: Mon Sep 09, 2002 6:42 pm

Post by waskelton4 »

thanks again man...
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

S'alright :). Glad it's sorted, problems like that can be really miserable to deal with when absolutely nothing seems to work.

Mac
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

I hate session_register().

Give me $_SESSION, or give me death!
Post Reply