|
 |
asptoday_discuss thread: Using a variable in a For Next and placing it in a Session variable
Message #1 by "Mark Berry" <mbfromit@h...> on Thu, 30 Aug 2001 23:34:35
|
|
Here is the code I am having problems with
<%
For i = 0 to 9
ID = Session("cart(0,i)")
Qty = Session("cart(1,i)")
%>
<tr>
<td><%=ID%></td>
<td><%=Qty%></td>
</tr>
<% next %>
</table>
The variable "i" is not seen inside the Quotation marks in
Session("cart(0,i)"), if I use a number, it works fine. This is
supposed to be a shopping cart, and I am trying to write out to
a table the values stored in the array named cart. The cart array
was dim as Session("cart(1,9)") in global.asa
In ASP 3.0 it says "Do not use a variable within quotation marks. But how
else are you going to loop through this array?
Help!!
Thanks!
Message #2 by "Pat Sullivan" <PSullivan@m...> on Fri, 31 Aug 2001 08:19:45 -0500
|
|
Try this
<%
For i =3D 0 to 9
ID =3D Session("cart(0," & i & ")")
Qty =3D Session("cart(1," & i & ")")
Next
%>
-----Original Message-----
From: Mark Berry [mailto:mbfromit@h...]
Sent: Thursday, August 30, 2001 6:35 PM
To: ASPToday Discuss
Subject: [asptoday_discuss] Using a variable in a For Next and placing
it in a Session variable
Here is the code I am having problems with
<%
For i =3D 0 to 9
ID =3D Session("cart(0,i)")
Qty =3D Session("cart(1,i)")
%>
<tr>
<td><%=3DID%></td>
<td><%=3DQty%></td>
</tr>
<% next %>
</table>
The variable "i" is not seen inside the Quotation marks in
Session("cart(0,i)"), if I use a number, it works fine. This is
supposed to be a shopping cart, and I am trying to write out to
a table the values stored in the array named cart. The cart array
was dim as Session("cart(1,9)") in global.asa
In ASP 3.0 it says "Do not use a variable within quotation marks. But
how
else are you going to loop through this array?
Help!!
Thanks!
|
|
 |