View Full Version : multiple selection listbox
Cailing
03-20-2005, 12:48 PM
How can i retrieve from database with the values selected in a multiple selection listbox?
<select name="user" size="6" multiple id="user">
<option value="Apple">Apple</option>
<option value="Pear">Pear</option>
<option value="Orange">Orange</option>
</select>
miranda
03-20-2005, 09:24 PM
I am not sure that I understand you here. But, to get the value selected from any listbox simply use the request object.
Bullschmidt
03-22-2005, 04:05 AM
So on a page receiving a post:
TheUser = Request.Form("User")
miranda
03-22-2005, 05:18 AM
Unless it is form method=GET then it is Request.Querystring("User")
Cailing
03-23-2005, 12:45 PM
may i kow how to use split. If possible give example....thanks in advance
Bullschmidt
03-23-2005, 06:04 PM
Parsing with join and split - 5/9/1999
http://www.4guysfromrolla.com/webtech/050999-1.shtml
"Whenever I need access to any record in this delimited text file, I first use the FileSystemObject to read in the entire text file into one string. I then issue a recArray = split(str,"*"), to get an array with each element a single record. Finally, to get each element in the record, I issue another split, elementArray = split(recArray(i),chr(13)), which stores each element of the ith record in elementArray."
Passing Arrays from One ASP Page to Another, Part 2 - 10/19/1999
http://www.4guysfromrolla.com/webtech/101999-1.2.shtml
Q5824 I have string values that look like this: "name, age, height" - How do I parse these so I can reference each value?
http://developer.irt.org/script/5824.htm
shocka
03-25-2005, 02:56 AM
Where you able to correctly fix this problem ??
If not let me know and I will give you the code you need.
You see I had much the same problem and the guys here helped me out so I am more than happy to return the favour
Shocka :)
Cailing
03-26-2005, 02:21 AM
This is the code that i had problem with.
<td align="left">*Interest(s): </td>
<td> <select name="userInterest" size="6" multiple id="userInterest"/>
<% arrInterest = Split(strInterest, ", ", -1, 1)
For i = LBound(arrInterest) To UBound(arrInterest)%>
<option <%if arrInterest(i)="Benchmarking and Measurments Systems" then response.write "selected"%> value="Benchmarking and Measurments Systems">Benchmarking and Measurments Systems</option>
<option <%if arrInterest(i)="Benefits" then response.write "selected"%> value="Benefits">Benefits</option>
<option <%if arrInterest(i)="Best-sourcing" then response.write "selected"%> value="Best-sourcing">Best-sourcing</option>
<option <%if arrInterest(i)="Exit Management" then response.write "selected"%> value="Exit Management">Exit Management</option>
<option <%if arrInterest(i)="Performance Management" then response.write "selected"%> value="Performance Management">Performance Management</option>
<%Next%>
</select></td>
If "Benefits" and "Exit Management" had been selected.
I want it to look like this:
Benchmarking and Measurments Systems
Benefits
Best-sourcing
Exit Management
Performance Management
But what i get is this:
Benchmarking and Measurments Systems
Benefits
Best-sourcing
Exit Management
Performance Management
Benchmarking and Measurments Systems
Benefits
Best-sourcing
Exit Management
Performance Management
Pl. Can help me correct my code.Thanks
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.