Solved

Insert values from 10 textboxes with same name in asp

Posted on 2004-04-04
4
244 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

840 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