Re: Arrays

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

 



GH wrote:
Would it be possible in a form fields name to make it an array?

This way it would be i.e. att[$part_id]

Now is there a way to iterate through the array when I submit the form
to process it, being that the ID numbers are not going to be
sequential and that there will be some numbers not included?

I.E. the id's would be 1, 5, 6, 7, 20, 43

and how would I refence it? would it be $_POST['att']['[partIDhere}'] ?

Did you try that at all?

<input type="text" name="att[1]" value="" />
<input type="text" name="att[5]" value="" />
<input type="text" name="att[9]" value="" />

Then to loop through them:

foreach($_POST['att'] as $part_id => $value)
{ echo "For part id: $part_id you supplied: $value"; }

--

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

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