every time you run mainpage.php, the array is being reinitialised. Lose the line "$myArray=array();". Tim Ward Senior Systems Engineer Please refer to the following disclaimer in respect of this message: http://www.stivesdirect.com/e-mail-disclaimer.html > -----Original Message----- > From: Christian [mailto:[EMAIL PROTECTED]] > Sent: 30 April 2001 09:17 > To: [EMAIL PROTECTED] > Subject: session array :-/ > > > Hi, > > I'm having trouble with a two dimensional array with sessions. > Following is an example of my code which is split between three pages. > > -------------------------------- > ### myFunctions.php ### > > function addToMyArray($newStuff) > { > global $myArray; > $myArray[]=array("id"=>$newStuff[myId],"name"=>$newStuff[name]); > } > > > ### mainPage.php ### > > session_start(); > include("myFunctions.php"); > > $myArray=array(); > session_register(myArray); > > // add some stuff to myArray here to highlight the prob > $myArray[]=array("id"=>"1","name"=>"gabby"); > $myArray[]=array("id"=>"2","name"=>"marla"); > > .. > > // if conditions meet > addToMyArray($HTTP_POST_VARS); > > // code to open myOtherWindow.php in a new window. > > // code to submit a form whos action is PHP_SELF > > > > ### myOtherWindow.php ### > > session_start(); > > // code to display contents of myArray > > ------------------------------ > > Now on first call to addToMyArray() > I have three elements two that I added directly > and one via the function call. > > Now if the function gets called again there is still > only 3 elements .. two that I added directly and the > third one from the latest function call. > The element from the first call has simply vanished !!! > And that's my problem, why is the element vanishing ??? > > Thanx, > Christian > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]