Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

arrays in asp 1

Status
Not open for further replies.

meenakshidhar

Programmer
Oct 19, 2001
77
MY
Hi friends,
My code is given below-

one.asp--

<form action="two.asp" method="post">
<%
Dim rs_country
set rs_country=Server.CreateObject("ADODB.recordset")
set rs_country=conn.execute("select * from country")
Do While Not rs_country.EOF
%>
<input name="price()" type="text" maxlength="20" size="10" class="textbox"><br>
<input type="hidden" name="country_id()" value="<%Response.Write rs_country("country_id")%>">
<%
rs_country.movenext
Loop
%>
<input type="submit" value="Add Rate Table">
</form>

two.asp--

For each x in Request.Form("price()")
c=Request.Form("country_id(x)")
set rs_insert=conn.execute("insert into two (country_id,price) values('" & x &"','" & ?? &"'")
Next

i want to insert country_id corresponding to given price but don't know how to get the value of country_id() array...
Urgent help needed...

Regards
Meenakshi
 
It doesn't look like you have multiple form elements with the same name, so you would just do this.

Code:
Set rs_insert=conn.execute("insert into two (country_id,price) values('" & Replace(Request.Form("country_id()"), "'", "''") &"','" & Replace(Request.Form("price()"), "'", "''") &"'")
 
the data should be inserted into my table in this manner

country_id price
1 12
2 33
3 66

and so on...
country_id field is of INT type and price is of Varchar type..
 
this makes it clear (hopefully) withou the use of a table...


one.asp
Code:
<form action="two.asp" method="post" ID="Form1">

<input name="price" type="text" maxlength="20" size="10" class="textbox" ID="Text1"><br>
<input type="hidden" name="country_id" value="1" ID="Hidden1">


<input name="price" type="text" maxlength="20" size="10" class="textbox" ID="Text2"><br>
<input type="hidden" name="country_id" value="2" ID="Hidden2">

<input name="price" type="text" maxlength="20" size="10" class="textbox" ID="Text3"><br>
<input type="hidden" name="country_id" value="3" ID="Hidden3">


<input type="submit" value="Add Rate Table" ID="Submit1" NAME="Submit1">
</form>

(and i use the variables without ()


two.asp:
Code:
<%
dim i
i = 1
For each field in request.form("price")
    response.Write  Request.Form("country_id")(i) 
    response.Write  Request.Form("price")(i) & "<br>"
    i = i + 1
next
%>


ttmug.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top