pass array? dynamic insertion?
Looking for your help
i'm doing an add.asp to add records to DB.
well, for i have many tables, in the add page, i won't know what field names will be. therefore, "dynamic insertion" required.
My purpose is here:
every input field named as field.name which can be obtained by reading the DB first.
for each field in Rs.fields
response.write F.name
response.write "<input type='text' name="& F.name &">"
next
then submit the [form] to confirm.asp
since have to retrieve the content of input, i do this
request.Form(must write F.name) in confirm.asp
well, my page don't know what's the F.name in dynamic sense.
i think of one way :
read the DB once more, and retrieve the Field names
but this is expensive, or i don't want to do sth. like this
another way is:
store the field names in an array in an order, then pass the array to next page (e.g. using the hidden type) after that retrieve the filed name from the passed array and do request to get data
well, well, well. don't know how to pass array. i stored the array and for each element in the arry, i used hidden type. That means i still passeda individual value not an array. quite exhausted !!
[NOTE] I didn't use <input name="oneNameforall" type=text> for all the input areas in Add.asp. because index of collections will not exactly match the order that appears in the html form. using array to keep everything in order is wat I want.
any suggestions?
regds
|