[b]
idx = 1 ' JavaSccript arrays are zero based.
theArray = theArray & " csArray[0]=(['select state',0]);" & vbLF
[/b]
' fill the array from our recordset
While NOT rs.eof
theArray = theArray & " csArray["& idx &"]=(['"
for each item in rs.fields
theArray = theArray & item & "','"
next
' backoff the trailing ,' and terminate the line with ]);
theArray = Left(theArray, Len(theArray)-2) & "]);" & vbLF
' increment our array index
idx = idx + 1
rs.movenext
Wend
don't forget to change the POST handling in case the user left the index at 0 (= no selection)
I didn't check that element 0 is said " selected"
I'm not sure either I have put all the required values in the []