Im trying to multiply variables to get a total but its throwing an error. i need the two cart variables to be multiplied first and then added to 'cartweight'. The following works fine but doesnt include the quantity of each item (session.cart[4]):
<cfset cartweight = cartweight + #session.cart[5]#>
but this doesnt work:
<cfset cartweight = cartweight + #session.cart[5]# * #session.cart[4]>
neither does this:
<cfset cartweight = cartweight + (#session.cart[5]# * #session.cart[4])>
or this:
<cfset cartweight = cartweight + ((#session.cart[5]#) * (#session.cart[4])>
the error is this :
Just in time compilation error
Invalid parser construct found on line 7 at position 76. ColdFusion was looking at the following text:
> (or "
", depending on which of the above i tried)
Invalid expression format. The usual cause is an error in the expression structure.
any ideas?
<cfset cartweight = cartweight + #session.cart[5]#>
but this doesnt work:
<cfset cartweight = cartweight + #session.cart[5]# * #session.cart[4]>
neither does this:
<cfset cartweight = cartweight + (#session.cart[5]# * #session.cart[4])>
or this:
<cfset cartweight = cartweight + ((#session.cart[5]#) * (#session.cart[4])>
the error is this :
Just in time compilation error
Invalid parser construct found on line 7 at position 76. ColdFusion was looking at the following text:
> (or "

Invalid expression format. The usual cause is an error in the expression structure.
any ideas?