On Wed, 2006-02-01 at 11:07, 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
You forgot the array append operator:
<input type="text" name="xname[]" value="3303"
<input type="text" name="xname[]" value="9854"
....
<input type="text" name="xname[]" value="n..."
I also took the liberty of adding double quotes to your attributes. There's no
excuse for writing slop.
To see what that produces... get used to doing:
echo '<pre>'."\n";
print_r( $_POST );
echo "\n".'</pre>';
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php