Solved

Insert values from 10 textboxes with same name in asp

Posted on 2004-04-04
4
240 Views
Last Modified: 2008-03-06
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.
0
Comment
Question by:ayha1999
  • 2
4 Comments
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10752552
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

%>

0
 
LVL 31

Accepted Solution

by:
alorentz earned 500 total points
ID: 10752766
No need to split:

<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>

'''''''''''''''''''''''''''''''''''''''''new page

    For each element in request(var1)
             Response.write element & "<br>"
              'sql = "Insert into table(attrname) value(" & element &")"
              'execute sql command
     Next
0
 
LVL 11

Expert Comment

by:Slimshaneey
ID: 10764111
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
0
 
LVL 31

Expert Comment

by:alorentz
ID: 10858533
Why a "C"?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
UTC (timezone) without using an API 16 28
SQL Filter Question 8 69
Choose the older file FSO 6 32
Auto Submit on dropdown box 14 32
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now