katherinep
Programmer
Hello,
I have a field in a db which holds colours and they are seperated by commas: red,blue,green etc. The colours are needed to populate a dropdown box in a form, but split by the commas.
The page I have is in Coldfusion and I am converting it to ASP. The code in ColdFusion is
Can anyone help me, ive been looking about and have found a bit of code that removes the commas:
But now I can't get this to populate my dropdown. This is probably very easy but I have been trying to find the answer for a couple of days now with no luck,
Thanks,
Katherine
I have a field in a db which holds colours and they are seperated by commas: red,blue,green etc. The colours are needed to populate a dropdown box in a form, but split by the commas.
The page I have is in Coldfusion and I am converting it to ASP. The code in ColdFusion is
Code:
<CFIF #len(varColours)# gt 0>
<CFLOOP list="#varColours#" delimiters="," index="idx">
<CFOUTPUT>
<OPTION VALUE="#idx#">#idx#</OPTION>
</CFOUTPUT>
</CFLOOP>
</CFIF>
Can anyone help me, ive been looking about and have found a bit of code that removes the commas:
Code:
<%
Dim strAryWords
Dim strValue
strValue = rstGetCarColour("Colours")
strAryWords = Split(strValue, ",")
' - strAryWords is now an array
Dim i
For i = 0 to Ubound(strAryWords)
Response.Write i & " = " & strAryWords(i) & "<BR>"
Next
%>
Thanks,
Katherine