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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Choose multiple value/name from drop down list.

Status
Not open for further replies.

19511950

Programmer
Apr 4, 2003
46
US
Hi,
I can choose multiple rows from drop down list and get value into the query.
select * from table where StateID in (1,15,17).

Also I need to pick the State Name in the same sequence: "You choose ALABAMA,INDIANA,KANSAS states."
Can I get the value of ID?

<select name=Date2 multiple>
<option value="1" id="ALABAMA">ALABAMA</option>
<option value="3" id="ARIZONA">ARIZONA</option>
<option value="15"id="INDIANA">INDIANA</option>
<option value="16"id="IOWA">IOWA</option>
<option value="17"id="KANSAS">KANSAS</option>
</select>

Regards,
Mark
 
You cant access the ID using ASP. But, how about changing the values to "1-ALABAMA", "3-ARIZONA", "15-INDIANA", etc.

You could then separate the state names and id's in the page that processes the form.

Tony
_______________________________________________________________
 
I need both. (1,15,17) and (ALABAMA,INDIANA,KANSAS)
 
Try this - it requires that your ID and state name are separate by a comma.

eg) <option value="1,Arizona">
Code:
<%
Dim strTest, strStates, strID, i

strTest = Split(Request.Form("Date2"),",")

For i=0 To UBound(strTest)
  If (i Mod 2) Then
    If strID <> "" Then
      strID = strID & "," & strTest(i)
    Else
      strID = strTest(i)
    End If
  Else
    If strStates <> "" Then
      strStates = strStates & "," & strTest(i)
    Else
      strStates = strTest(i)
    End If
  End If
Next

Response.Write strID & "<BR>" & strStates
%>

Tony
_______________________________________________________________
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top