Click to See Complete Forum and Search --> : Question about fields name...


weee
09-09-2005, 06:39 PM
I have a 100 fields and in the name of each field there's "[]" with some value in it. What I'm trying to do is to "take" the value that is in the "[]".

I have this so far:

For Each strKey In Request.Form
strValue = Request.Form(strKey) & ""
If strValue <> "" Then
Response.Write strKey & ": " & strValue & "<br />"
End If
Next


One of my fields looks like that:
<input type="text" name="Music Cabinet [8]" /> Music Cabinet

So how can I do it?

Thanks!

buntine
09-10-2005, 06:53 AM
Something like this should suffice:

Dim intStartIndex, intLength

For Each strKey In Request.Form
strValue = Request.Form(strKey) & ""
If strValue <> "" Then
intStartIndex = InStr(strValue, "[")
intLength = InStr(intStartIndex, strValue, "]")
Response.Write strKey & ": " & Mid(strValue, intStartIndex, intLength) & "<br />"
End If
Next

weee
09-10-2005, 02:12 PM
Nice, thanks!

buntine
09-10-2005, 10:08 PM
:)