Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiselect Select Box

Status
Not open for further replies.

Ouch

Programmer
Jul 17, 2001
159
GB
Can anyone help me,

i have a select box which i want users to be able to select more tha one thing from the list.

can anyone show me how?

i am using asp to generate the list from a database.



<select MULTIPLE name=&quot;LearnOut&quot; size=&quot;8&quot; style=&quot;font-family: Arial&quot;>
<option>&lt;&lt;Select Learning Outcomes&gt;&gt;</option>
<% Do While Not rslearnout.EOF %>
<option value=&quot;<% = rslearnout(&quot;learnout_id&quot;)%>&quot;>
<% = rslearnout(&quot;Learning_outcome&quot;) %>
</option>
<% rslearnout.movenext %>
<% loop %>
</select>
 
of course, thanks...

how about getting the selections into the database?

i have a table to put in recordID and Selection

eg

record selected
1346 1
1346 3
1346 6
1347 1
1347 7
1347 11

do you think this will work?

x = Split(strLearnOut, &quot;,&quot;)

For i = 0 To UBound(x)

strSelection = Trim(x(i))

'Insert into tbl_learning_outcomes

sqlStr = &quot;INSERT INTO tbl_learning_outcomes (applicationID, learnout_id) &quot;
sqlStr = sqlStr & &quot; VALUES &quot;
sqlStr = sqlStr & &quot;('&quot; & strreqid
sqlStr = sqlStr & &quot;', '&quot; & strSelection & &quot;')&quot;

Next

 
if strLearnOut holds the selected comma separated learnout_ids and you already know the value of strreqid the n your insert statement looks fine. It may be best to make sure that the record and selected value dont already exist in the same row before attempting to insert the data
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top