Re: Help retrieving an HTML array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 nothing
echo $xname[0] ; // this returns only first digit of the first input

None 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@xxxxxxxxx>:
Newbe 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


--
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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux