Link to home
Start Free TrialLog in
Avatar of ayha1999
ayha1999

asked on

Insert values from 10 textboxes with same name in asp

im using classic asp. i have an html form with 10 textboxes with same. can is use one statement to insert all these textbox values into the table.

eg.
Insert into table(name) values (txtbox1).

please help if any solution is available.
Avatar of venkateshwarr
venkateshwarr

Yes you can do that, but it is advisable to use diffrenent name.
The following example can help you....

<form method=get>
      <input type=text name=var1 value=hello1>
      <input type=text name=var1 value=hello2>
      <input type=text name=var1 value=hello3>
      <input type='submit'>
</form>

<%
      qstr =  Request("var1")
      Response.write "str =  " & qstr & " <br/>"
      MyArray = split(qstr,",")

                        ' Do database connectins here
      For i=0 to Ubound(MyArray)
              Response.write MyArray(i) & "<br>"
                             'query = "Insert into table(attrname) value(" & MyArray(i) &")"
      Next

%>

ASKER CERTIFIED SOLUTION
Avatar of alorentz
alorentz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can also reference the items like so:
request.form("text1")(1)
request.form("text1")(2)
request.form("text1")(3)

this will reference each text box in order from 1 to 10 whan they are all named text1
Why a "C"?