I have done this several ways and i guess im just curious how others tackle this. I am getting ready to do this and then i was like " i wonder if there is a better way". So here we go.
I am reading values from the DB and for each record i will create a textbox.
As i loop i will have a counter. It will look like this
i = 0
Do While Not objRS.EOF
i = i + 1
<td><input type="text" name="txtHrs_<%=i%>"></td>
For the sake of an example, lets say i loop 3 times. So i have
txtHrs_3 For the names of my textboxes.
Now when i submit the form and write back to the DB, im going to do
something like this.
For i = 1 to 3
hrs = Request.form("txthrs_" & i)
'do my db stuff and add this value
Now this example is for a set number of records, this wont be the case w/ the application.
Also if some of the syntax is off thats ok, this was just an example, i did not include all the code, such as for i = 1 to 3, well yes i would not hard code the 3, that would depend on how many records were looped, etc.
Any way i just wanted to see what other options i have available as this is the way i usually do it, but i thought about using the Forms collection, but have never done that and im not sure if the Forms collection will just return my text box or if its going to return the buttons, radio, check, text, tetxtarea, etc.
Or it might just be that the way i do it is perfectly fine.