Re: Getting results from Select Multiple HTML tag

From: Date: Tue, 06 Jan 2004 04:26:34 +0000
Subject: Re: Getting results from Select Multiple HTML tag
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-173821@lists.php.net to get a copy of this message
Easiest way is this foreach ($_POST['test'] as $key => $value) { echo $key . '|' . $value . "\n"; } By putting the [] on the end of the variable name in the html, it has turned the variable test into an array. Because test is a post variable, it is now multidimensional. "Tyler Longren" <tyler@jdhost.com> wrote in message news:1073361947.6845.6.camel@workstation2.jdhost.com... 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[]']); That doesn't even look right. Anyone understand what I'm tryin to get at? Any help would be great. Best Regards, -- Tyler Longren J.D. Web Services, L.C.

« previous php.general (#173821) next »