PLEASE PLEASE HELP.. ANY HELP WILL BE GREATFULLY APPRECIATED!!
this is the code for view.asp.
when i click the button on the page that allows the user to view the contents of the shopping cart i get this error:
Error Type:
Microsoft VBScript runtime (0x800A0009)
Subscript out of range: '[number: 3]'
/viewcart.asp, line 93
this is a snippet, from the code below, where this error occurs.
<%
subtotal = CCur (splitArray (3))*_
CInt(quantity)
total = total + subtotal
%>
<TD>
<%=subtotal%>
</TD>
</TR>
<% @LANGUAGE = VBSCRIPT %>
<% Option Explicit %>
<%'checklogin.asp %>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional //EN">
<HTML>
<HEAD>
<TITLE> View</TITLE>
<link rel="stylesheet" href="../../../../xml%20fligts/style.css" type="text/css">
</HEAD>
<BODY BGCOLOR = "#FFFF99" class="stylesheet1">
<CENTER>
<H1><U>High Flyers </U></H1><BR><BR>
<H2>The total price for your choosen flight is: </H2>
<%
'Dimension variables
Dim i 'Holds the Database Connection Object
Dim splitArray 'Holds the recordset for the records in the database
Dim quantity 'Holds the SQL query for the database
Dim total
Dim j
Dim subtotal
Dim bought
If Request.Cookies("Books")="" Then %>
<CENTER>
<H3>
<FONT COLOR = "red">
Your cart is empty.
</FONT>
</H3>
</CENTER>
<%
Else%>
<TABLE BORDER = "1" ALIGN = "CENTER" WIDTH = "100%"
CELLPADDING = "0" CELLSPACING = "3">
<CAPTION>
<H2>
<FONT COLOR = "brown">
This is your current cart.
</FONT>
</H2>
</CAPTION>
<COLGROUP>
<COLSPAN = =="6" ALIGN = "CENTER">
</COLGROUP>
<TR>
<TH><U>Title</U></TH>
<TH><U>Author</U></TH>
<TH><U>ISBN</U></TH>
<TH><U>PRICE</U></TH>
<TH><U>QUANTITY</U></TH>
<TH><U>SUBTOTAL</U></TH>
</TR>
<% total = 0
For i= 1 To Request.Cookies("Books").Count/2
splitArray = Split( Request.Cookies("Books")_
("book" & CStr (i)),"|" )
%> <TR>
<%
For j = 0 To UBound (splitArray) %>
<TD> <% =splitArray(j) %> </TD>
<%
Next
quantity = Request.Cookies("Books")("quantity" & _
CStr(i))
%>
<TD>
<%=quantity%>
</TD>
<%
subtotal = CCur (splitArray (3))*_
CInt(quantity)
total = total + subtotal
%>
<TD>
<%=subtotal%>
</TD>
</TR>
<% Next
%>
<TR>
<TH COLSPAN = "6" ALIGN= "right"><U>Total:</U></TH>
<TD> <%=total%></TD>
</TR>
</TABLE>
<% End If %>
<br>
<CENTER><A HREF = "buyit.asp">Back To Shopping</A>
</CENTER>
</BODY>
</HTML>