> // method 1
> $_SESSION['array1'] = array("item1", "item2");
> 
> // method 2
> session_register("array2");
> $array2 = array("itemA", "itemB");
> 
> header ("Content-type: text/html");
> 
> echo $array1[0]. "<br />";
> echo $array2[0];
> ?>
> 

Well, you're not assigning anything to $array1 (assuming you have
register_globals off - it sounds like you have them on which is why
$array1 isn't set until the next PHP page is loaded).

You need add this line for your example to work as you expect it.
// this is assuming you leave register_globals on
if( empty( $array1 )) $array1 = $_SESSION[array1];

// if you turn register_globals off you just do:
$array1 = $_SESSION[array1];

-chicken


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

Reply via email to