RE: [PHP] Basic multi-dimensional array help

From: Date: Tue, 03 Jul 2001 16:32:29 +0000
Subject: RE: [PHP] Basic multi-dimensional array help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-56007@lists.php.net to get a copy of this message
that's stanard array behaviour... $Info contains two elements, $Info[0] and $Info[1] $Info[0] contains four elements, $Info[0][0], $Info[0][1], $Info[0][2], $Info[0][3] try this function on your $Info variable to see what it contains: array_traverse($Info); function array_traverse ($ary, $b=array()) { while ( list($k,$v) = each($ary) ) { print (join("", $b)) . "$k = $v\n"; array_push($b, "\t"); if ( is_array($ary[$k]) ) { array_traverse($ary[$k], $b); } array_pop($b); } return 1; } > -----Original Message----- > From: Jeff Gannaway [mailto:webmaster@cactusgraphics.com] > Sent: Tuesday, July 03, 2001 8:05 AM > To: php-general@lists.php.net > Subject: [PHP] Basic multi-dimensional array help > > > I've got input fields in a form that look like: > <INPUT TYPE=HIDDEN NAME=Person[0] VALUE=Jeff> > <INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Apples> > <INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Oranges> > <INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Peaches> > <INPUT TYPE=CHECKBOX NAME=Info[0][] VALUE=Pears> > > <INPUT TYPE=HIDDEN NAME=Person[1] VALUE=Carolyn> > <INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Apples> > <INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Oranges> > <INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Peaches> > <INPUT TYPE=CHECKBOX NAME=Info[1][] VALUE=Pears> > > The next script processes all this into a database. Here are the results I > get from various commands: > > sizeof($Info): 2 > sizeof($Info[0]): 4 > print $Info[0][0]: Array[0] > > Any help? > Jeff Gannaway > > ___________________________________________________________ > > SUMMER ART PRINT SALE at www.PopStreet.com > Save an additional 10% off art print orders of $50 or more. > Type in coupon code jemc when checking out. > ___________________________________________________________ > > Find the right art print for your home. > * Search by artist, color, art style and subject. > * Preview the art prints against your wall color. > * Specializing in contemporary, abstract and African >   American art. > * Every day discounts on thousands of fine art prints. > > PopStreet.com is your avenue to art. > > > http://www.popstreet.com > ___________________________________________________________ > Coupon may be redeemed from June 27 through July 31, 2001. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#56007) next »