Solved

Insert values from 10 textboxes with same name in asp

Posted on 2004-04-04
4
246 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

733 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