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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing value of textbox created dynamically, into an array

Status
Not open for further replies.

cawi17

IS-IT--Management
Oct 25, 2002
18
0
0
MY
Hi... I got 2 asp pages... I page is where I created a form dynamically using...

***********************************************************
.
.
.

dataConn= "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("cd2buy.mdb")
cn.open dataConn

Set rs = cn.Execute("SELECT * FROM CART where Customer_User_Name='" & Session("username") & "'" )

if rs.EOF = True and rs.BOF = True then 'no cart record available, cart is empty
Response.Write ("<br><br><br><br><p align=" & chr(34) & "center" & chr(34) & ">Your Cart is Empty" & "</p>")
Else ' cart not empty, cart record available
totalprice = 0

Response.Write("<br><br><br><font face=" & chr(34) & "arial" & chr(34) & " size=4><p align=" & chr(34) & "center" & chr(34) & "><strong>" & Session("username") & "'s Shopping Cart</strong></p></font><br>")
Response.Write("<table width=" & chr(34) & "550" & chr(34) & " border=" & chr(34) & "0" & chr(34) & " align=" & chr(34) & "center" & chr(34) & "> <tr><td bgcolor=" & chr(34) & "#cccccc" & chr(34) & "><font face=" & chr(34) & "arial" & chr(34) & " size=2><strong>CD ID</strong></font></td> <td bgcolor=" & chr(34) & "#cccccc" & chr(34) & "><font face=" & chr(34) & "arial" & chr(34) & " size=2><strong>Title</strong></font></td><td bgcolor=" & chr(34) & "#cccccc" & chr(34) & "><font face=" & chr(34) & "arial" & chr(34) & " size=2><strong>Quantity</strong></font></td><td bgcolor=" & chr(34) & "#cccccc" & chr(34) &"><font face=" & chr(34) & "arial" & chr(34) & " size=2><strong>Price</strong></font></td><td><font face=" & chr(34) & "arial" & chr(34) & " size=2><strong>Remove cd?</strong></font></td></tr>")


Set Session("theDictionary") = Server.CreateObject("Scripting.Dictionary")

Response.Write ("<form name=" & chr(34) & "viewcart" & chr(34) & " method=" & chr(34) & "post" & chr(34) &" action=" & chr(34) & "dictionary2.asp" & chr(34) & ">")




i=0
while NOT rs.EOF
totalprice = totalprice + (rs("Price") * rs("Quantity") )
totalquantity = totalquantity + rs("Quantity")
'search cd title, artist
Set rs2 = cn.Execute("SELECT CD.Title, CD.Artist FROM CD where CD_ID=" & rs("CD_ID") )
'display each record of cd id, artist - title, quantity, price, remove cd check box
Response.Write("<tr><td><font face=" & chr(34) & "arial" & chr(34) & " size=2>" & rs("CD_ID") & "</td><td><font face=" & chr(34) & "arial" & chr(34) & " size=2>" & rs2("Artist") & " - " & rs2("Title") & "</td><td> <input maxlength=" & chr(34) &"3" & chr(34) & " size=" & chr(34) & "3" & chr(34) & " type=" &chr(34) & "text" & chr(34) & " name =" & chr(34) & "pquantity" & chr(34) & " value=" & chr(34) & rs("Quantity") & chr(34) &">" & "</td><td>RM" & FormatNumber(rs("Price"),2) & "</td><td> <input type="& chr(34) & "checkbox" & chr(34) & " name=" & chr(34) & "pdelete" & rs("CD_ID") & chr(34) &" value=" & chr(34) & "pdelete" & rs("CD_ID") & chr(34) & "></td></tr></font>")

Session("theDictionary").Add i, document.CStr(rs("Quantity")) 'CStr(Request.Form("pquantity"))

rs.Movenext
i=i+1
Wend
.
.
.
***********************************************************
that created an array of textboxes.....


and on another page, I would like retrieve the value entered by user(or changed by user) from each of the textboxes at the form created on the previous page - into a variable of array... How would I do it...? If possilbe, how would I insert them into a Session dictionary, or a dictionary.....

Hope you guyz can help...

Thank you very much....

cawi17...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top