Re: Help retrieving an HTML array
| From: | Joe Henry | Date: | Wed, 01 Feb 2006 16:14:46 +0000 |
| Subject: | Re: Help retrieving an HTML array | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-229641@lists.php.net to get a copy of this message | ||
The input name must include [] (brackets) to let php know it's an array.
Ex: input type=text name=xname[] value="3303"
On Feb 1, 2006, at 9:07 AM, Mauricio Pellegrini wrote:
Hi , I have a HTML page with a form in which there are some inputs like these: input type=text name=xname value="3303" input type=text name=xname value="9854" .... input type=text name=xname value="n..." the name of the input is always the same ( xname ) This generates automatically generates an array named xname in HTML with all the diferent values assigned to a diferent position. My question is : How do I retrieve that array from within PHP ? I've tryed the following $xname=$_REQUEST['xname']; and then echo $xname[0][0] ; // this returns nothingecho $xname[0] ; // this returns only first digit of the first inputNone of the above seem to recognize that xname is ( in HTML ) an array . Any help greatly appreciated Thanks Mauricio On Sun, 2005-10-02 at 19:38, adriano ghezzi wrote:if i understand well you need to get an array from html post if you use the same name for your html fields you automatically have an array in $_POST eg input type=text name=myfield value="field_1" input type=text name=myfield value="field_2" you'll get the array ar_myfield = $_POS['myfield'] you should achieve the same result using myfield[key] in the name of html hyh by ag. 2005/10/2, Martin van den Berg <martinvdberg@gmail.com>:-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpNewbe question: How does one convert an array into a HTML GET request easely? Are there any standard functions? Same for HTML POST requests. Thanks, Martin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php