Hi Joey,
Try something like this.
<%
''user submitted number already, i.e. 6
iNumberOfTextBo xes = Request.Form("t xtNumberOfTextb oxesDesired")
''code to make sure there was no
''nonsense input, like a letter, or empty, etc.
%>
<form method="post" action="process .asp">
<% For i = 1 To iNumberOfTextBo xes %>
<input name="txtTitle< %=i%>" type="text">
<input name="txtPrice< %=i%>" type="text">
<% Next %>
<input type="hidden" name="count" value="<%=iNumb erOfTextBoxes%> ">
<input type="submit">
</form>
process.asp:
<%
iCount = Request.Form("c ount")
'''open ado connection, oADO
For i = 1 To iCount
sTitle = Request.Form("t xtTitle" & i)
sPrice = Request.Form("t xtPrice" & i)
'''validate the input here
sSQL = "INSERT INTO someTable (Title,Price) VALUES ('" & sTitle & "'," &
sPrice & ")"
oADO.Execute sSQL,,129
Next
'''close and kill ADO connection
%>
That would be a basic layout of what would happen. You'd generate the form
on the fly with input boxes named:
txtTitle1,txtPr ice1
txtTitle2,txtPr ice2
txtTitle3,txtPr ice3
txtTitle4,txtPr ice4
....
Then you'd write the number to a hidden input.
Then when the form is submitted, you'd take the value from the hidden input
and use that to rebuild the input element names.
You'd want to make sure you add validation code all over.
Ray at work
"Joey" <no****@infosmi ths.net> wrote in message
news:uA******** ******@TK2MSFTN GP09.phx.gbl...
Say a customer inserts into a sql database field (NUMINSERTS) the number
6.
On the following page, I want to build a table that displays 6 input
boxes, since the customer said they wanted 6 text boxes.
I will then insert the data from the 6 text boxes back into another sql
database table.
For example:
Page 1: Ask client how many items they want to insert. Client types in
6.
Page 2: Table is displayed with input boxes for title of item 1 and
price of item 1. Then title for item2 and price for item 2, and on and
on until 6 are diaplyed.
How do I get the correct number of text boxes to be displayed? AND then,
how do I insert them into another table (ITEMINFO)
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!