RE: [PHP] multiple select boxes

From: Date: Tue, 29 Aug 2000 21:46:19 +0000
Subject: RE: [PHP] multiple select boxes
Groups: php.general 
Request: Send a blank email to php-general+get-14219@lists.php.net to get a copy of this message
You have to get a handle on the object with a loop. The link in the following mail from another list was the key. It took a bit of hacking to suit my needs, but worked beautifully. >The PHP section at www.faqts.com is one of the most useful resources I know. >(They have a javascript section as well) >I think this link from the php section probably answers your question: >http://www.faqts.com/knowledge-base/view.phtml/aid/98/fid/6/lang/en >Hope it helps >Liz med vänlig hälsning /Dana -----Original Message----- From: jpm@kefta.com [SMTP:jpm@kefta.com] Sent: Tuesday, August 29, 2000 7:29 PM To: billzeller@yahoo.com Cc: php-general@lists.php.net Subject: Re: [PHP] multiple select boxes On Tue, 29 Aug 2000, Bill Zeller wrote: > The problem is that this script stops working when I > rename "list2" to "list2[]" (to allow for multiple > selects) the script stops working. > > Secondly, is there a way to get all the values in a > select box? I'm not just looking for all the selected > values, but all them. This is because I'm using the > menu swapper, and the contents of each select box > change dynamically on the client. Hi Bill, Well I had the same problem a while ago. I was trying to create dynamic input fields on a form and then use some javascript to validate the data. However, you can't use "[]" on variable names on javascript, because the code would eventually look like this : writeln(this.document.form_name.inputfield[].value); and that's invalid. I couldn't find any way to get around this problem, so I just gave up and created input fields like inputfield_1, inputfield_2 and then do a dirty loop both on javascript and PHP to get the values. I'm not sure how you can change your javascript code to handle that, but it's worth a shot. Besides, javascript is just plain fun :) Regards, Joao -- Joao Prado Maia Web Developer Kefta.com, Inc

« previous php.general (#14219) next »