Re: complex arrays

From: Date: Thu, 05 Jan 2006 19:52:56 +0000
Subject: Re: complex arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-228234@lists.php.net to get a copy of this message
Oeps, it's already complex to explain this. The array that needs to be created and read is looking like this $vArray = array('uses'=>'J', $_POST['vke']); Maybe that will clear up thing a (tiny) bit). Thanks again, Sjef ""Sjef Janssen"" <manuals-scripts@planet.nl> schreef in bericht news:A6.2C.34518.4117DB34@pb1.pair.com... > Hallo there, > I try to put a number of variables in an array as follows: > input boxes gather info. This info is language dependent, so the info is > put > into an array vke with indexes NL and EN. The POST variable gives this > array > back. Then I want to add a variable to this array, 'gebruikt' (=used) with > possible values J or N. > > The script looks something like so: > > <?php > > session_start(); > > > if ($_POST['vkePlus']) > { > $waarden[] = array('gebruikt'=>'J',$_POST['vke']); > foreach ($waarden as $i=>$w) > { > if (is_array($w)) > { > foreach($w as $iw=>$ww) > { > if (is_array($iw)) > { > //What happening here??? > } > else > { > echo stripslashes($iw) . ": " . stripslashes($ww) . "<br/>"; > } > } > } > else > { > echo stripslashes($i) . ": " . stripslashes($w) . "<br/>"; > } > } > } > > > print ("<h1>Test</h1>\n"); > print ("<form method=\"post\" action=\"" . > $_SERVER['PHP_SELF'] . > "\">\n"); > print ("<input type=\"text\" size=\"10\" name=\"vke[NL]\" > value=\"" . > $vke[NL] . "\">\n"); > print ("<input type=\"text\" size=\"10\" name=\"vke[EN]\" > value=\"" . > $vke[EN] . "\">\n"); > print ("<input type=\"submit\" name=\"vkePlus\" > value=\"GoGo\">\n"); > print ("</form>\n"); > ?> > > I have problems reading the contents of the arrays. Especially reading the > second array seems impossible. > After all this I want to add the contents of the array to a Session > variable > to keep it in furthwer steps (of a wizard). > > I hope any of you can 'make chocolat' of this.... ;-)) > Thanks!! > Sjef > > p.s. I use php 4.

« previous php.general (#228234) next »