On 06 January 2004 04:06, Tyler Longren wrote:

> Hi,
> 
> http://www.php.net/manual/en/faq.html.php#faq.html.select-multiple
> 
> I read that.  Doesn't work in php since the whole register_globals
> thing.  Now, when I get the results from a form, they're all in a
> $_POST[] array.  Example. 
> 
> When I have a <select name="test" MULTIPLE>
> I would have to access the values of the "test" field like this:
> count($_POST['test']); 
> 
> But since I have to have the [] in the name="<select name="test[]"
> MULTIPLE>" ()part, I get parse errors when trying to read it:
> ex: count($_POST['test[]']);

The array you get is $_POST['test'] -- you can use that just like any other
array, so:

   $how_many = count($_POST['test']);

   $first = $_POST['test'][0];
   $second = $_POST['test'][1];

etc.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to