Re: Getting results from Select Multiple HTML tag
| From: | Tyler Longren | Date: | Tue, 06 Jan 2004 04:26:41 +0000 |
| Subject: | Re: Getting results from Select Multiple HTML tag | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173820@lists.php.net to get a copy of this message | ||
Hi Tom,
$_POST['test'][] doesn't work. I thought I had tried $test =
$_POST['test'] before and it didn't work. I just tried it though and it
seemed to work.
Thanks Tom!
Tyler
On Mon, 2004-01-05 at 22:20, Tom Rogers wrote:
> Hi,
>
> Tuesday, January 6, 2004, 2:05:47 PM, you wrote:
> TL> Hi,
>
> TL>
> TL> http://www.php.net/manual/en/faq.html.php#faq.html.select-multiple
>
> TL> I read that. Doesn't work in php since the whole register_globals
> TL> thing. Now, when I get the results from a form, they're all in a
> TL> $_POST[] array. Example.
>
> TL> When I have a <select name="test" MULTIPLE>
> TL> I would have to access the values of the "test" field like this:
> TL> count($_POST['test']);
>
> TL> But since I have to have the [] in the name="<select name="test[]"
> MULTIPLE>>" ()part, I get parse errors when trying to read it:
> TL> ex: count($_POST['test[]']);
>
> TL> That doesn't even look right. Anyone understand what I'm tryin to get
> TL> at? Any help would be great.
>
> TL> Best Regards,
> TL> --
> TL> Tyler Longren
> TL> J.D. Web Services, L.C.
>
>
> try $_POST['test'][]
> or copy it to another array
>
> $test = $_POST['test'];
>
> print_r($test);