Forums

This topic is locked

Dynamically Selected List/Menu From DB

Posted 25 Dec 2002 17:23:59
1
has voted
25 Dec 2002 17:23:59 Buddy Quaid posted:
Okay here's my delimma. In a products table I have a field for the color of an item. Since an item can have many colors the colors are seperated by a comma eg: 1,2,3,4,5. Those represent color ID's from a COLORS table. They are hashed out using the SPLIT method in ASP. Everything works fine as far as displaying them and so forth but this is for the update page. I need the list to come up and show the selected ones but show the whole list at the same time. I can't figure how to make it all work.

This is what is there so far:
<%
While (NOT updateRS.EOF)
%>
<option selected>size:
<%'// the following lines check the database to see if the article is in the ArticleList
allcolors=split(updateRS("colors",","
maxcounter=ubound(allcolors)
FOR counter=0 TO maxcounter
thissize=allcolors(counter)
Response.Write("<option value=" & thiscolor & ""
Response.Write(">" & thiscolor & "<br>" & Vbcrlf)
NEXT%>
<option value="<%=(updateRS.Fields.Item("colors".Value)%>" <%if (CStr(updateRS.Fields.Item("colors".Value) = CStr(updateRS.Fields.Item("title".Value)) then Response.Write("SELECTED" : Response.Write(""%>><%=(updateRS.Fields.Item("title".Value)%></option>
<%
updateRS.MoveNext()
Wend
If (updateRS.CursorType > 0) Then
updateRS.MoveFirst
Else
updateRS.Requery
End If
%>

but that doesnt work... any suggestions? Thanks!

Buddy

Reply to this topic