RE: [PHP] Array - problem

From: Date: Wed, 13 Sep 2000 12:10:55 +0000
Subject: RE: [PHP] Array - problem
Groups: php.general 
Request: Send a blank email to php-general+get-16544@lists.php.net to get a copy of this message
To build an array from HTML Form fields, you have to add square brackets [] to the NAME: <input type='hidden' name='info[]' value='1'> <input type='hidden' name='info[]' value='3'> <input type='hidden' name='info[]' value='12'> If the script would look like this: <? for($c=0; $c<count($info); $c++) { echo "Value in array element $c is: ".$info[$c]."<BR>\n"; } ?> The out put would look like this: Value in array element 0 is: 1 Value in array element 1 is: 3 Value in array element 2 is: 12 Hope this helps. Cheers Marc > -----Original Message----- > From: David Tandberg-Johansen [SMTP:david@datajo.no] > Sent: Wednesday, September 13, 2000 12:57 PM > To: php-general@lists.php.net > Subject: [PHP] Array - problem > > Hello! > > I wonder if anyone could help me. > > I have a script that generates a form width several hidden fields. > > Example: > <input type='hidden' name='info' value='1'> > <input type='hidden' name='info' value='2'> > <input type='hidden' name='info' value='3'> > > What I want is to put the values of the 'info' fields into an array in the > next script, so i can extract the information from the 'info' array , and > put it in a mysqldb with some other information. > > I hope I asked in a way that you understand. > > Thak you, in front > > > > -- > 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 (#16544) next »