Re: Multidimensional form input array.

From: Date: Wed, 10 Oct 2001 17:17:46 +0000
Subject: Re: Multidimensional form input array.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-70706@lists.php.net to get a copy of this message
first take a look at the array, make sure all the ields really are there. print_r($Array); then loop through the array in a way that will allow or assosiative index's and numeric index's out of order. foreach ( $Array['data'] as $pos => $val ) echo "$val <br>"; is everything there now ? -- Chris Lee lee@mediawaveonline.com "Alexander Deruwe" <a@deruwe.be> wrote in message news:20011010152938.B17B121725F@tartarus.telenet-ops.be... > Hewwo everyone, > > I'm having a problem with multidimensional form input arrays. Suppose there > is a form set up like this: > > .. some hidden input fields .. > <input type="hidden" name="Array[FileName]" value=something dynamic> > .. > > .. then a loop (or section if you will, since I use smarty) .. > <input type="text" name="Array[data][dynamic index][data_field]" > value=something dynamic> > > The 'dynamic index' is the smarty loop index variable, which counts up from 0. > > (Now, besides from the fact that someone already pointed out to me that > $Array might not be a good choice for naming this thing, I haven't before > found any problems relating to that so I'm going to try and find another > solution first) > > In my .php file I loop over the data as such: > > for ($i = 0; $i < count($Array['data']); $i++) > { > // do stuff with data fields in $Array['data'][$i] > } > > But all the data fields are, not there, not set I guess. > > Is there any reason for this? > > Alexander.

« previous php.general (#70706) next »