PDA

View Full Version : Looping through Array | form elements


[o_O]
01-14-2003, 09:22 PM
Edit: original prob was sorted out -guy left out little bit of code needed.

[o_O]
01-15-2003, 01:19 AM
Right my question is What below is making the 'item_quantity' into a string?

is it the Trim function?



If Request("updateQ") <> "" Then
Dim cartU, newQ
cartU = Session("cart")
For i = 0 To Ubound(cartU, 2)
newQ = Trim(Request("q" & cartU(item_id, i)))
If newQ = "" or newQ = "0" Then
cartU(item_id, i) = ""
Else
If isNumeric(newQ) Then
cartU(item_quantity, i) = newQ
End If
End If
Next
Session("cart") = cartU
End If
%>




Before updating qauntity, I can get the Sum of the 'item_qauntity' column but after it acts like there not numbers anymore i.e 1+2= 12 :mad:

raf
01-15-2003, 07:44 AM
yes it is

info from helpfile
___________

Description
Returns a copy of a string without leading spaces (LTrim), trailing spaces (RTrim), or both leading and trailing spaces (Trim).
Syntax
LTrim(string)
RTrim(string)

Trim(string)

The string argument is any valid string expression. If string contains Null, Null is returned.

_______________________

if your sure its a numeric value, just use a conversion like
CInt(variable) or CDbl(variable)