faqts : Computers : Programming : Languages : JavaScript : Forms : SELECT

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

19 of 21 people (90%) answered Yes
Recently 10 of 10 people (100%) answered Yes

Entry

I want to name a SELECT 'someSelect[]' for PHP, but I think the '[]' are illegal in JS. Help.

Aug 7th, 2002 05:56
Jenni Koskenpää, Ashish Chamoli, Alex Dean,


------------------
Just add
ID="ListBoxName"
to your existing listbox, after alteration which will look like :
Name="ListBoxName[]" ID="ListBoxName"
and thereafter it will solve the problem of different names for 
JavaScript and PHP.
Take Care,
Ashish Chamoli
------------------
Above doesn't work with Netscape so I prefer naming your script like 
below: 
<select name="var[]" multiple>
And Javascript like: 
variable = documents.forms[0].elements['var[]'];
See more help: http://www.php.net/manual/en/faq.html.php
-Jenni