<%
dim col1(2)
col1(0)=0
for i=1 to 2
col1(i)=TRIM(Request("col1(i)"))
col1(i)=cINT(col1(i))
total1=col1(i)+col1(i-1)
next
%>
-------------------------------------------------------
considering change to following code
1)
dim col1(2) means you have 3 elements
col1(0), col1(1), col1(2)
2)
before doing CINT, you have to check the
parameter, make sure it's Numeric, if it;s
not, say, a non-numeric string or Null, you
will get the error : Type Mismatch
3) this is the right way
total1 = total1 + col1(i)
-------------------------------------------------------
<%
dim col1(2)
total1 = 0
for i=1 to 2
col1(i)=TRIM(Request("col1(" & i & ")"))
if isnumeric(col1(i)) then
col1(i)=cINT(col1(i))
else
col1(i)=0
end if
total1 = total1 + col1(i)
next
%>
dim col1(2)
col1(0)=0
for i=1 to 2
col1(i)=TRIM(Request("col1(i)"))
col1(i)=cINT(col1(i))
total1=col1(i)+col1(i-1)
next
%>
-------------------------------------------------------
considering change to following code
1)
dim col1(2) means you have 3 elements
col1(0), col1(1), col1(2)
2)
before doing CINT, you have to check the
parameter, make sure it's Numeric, if it;s
not, say, a non-numeric string or Null, you
will get the error : Type Mismatch
3) this is the right way
total1 = total1 + col1(i)
-------------------------------------------------------
<%
dim col1(2)
total1 = 0
for i=1 to 2
col1(i)=TRIM(Request("col1(" & i & ")"))
if isnumeric(col1(i)) then
col1(i)=cINT(col1(i))
else
col1(i)=0
end if
total1 = total1 + col1(i)
next
%>