First, the fid bit. You want:
<cfset fid = form["Quantity" & itemid]>
Same goes for any other scope variables - if you are creating the
name dynamically, use the sqaure bracket notation. The pound signs #
are mostly unnecessary if the name is created as above.
Likewise,
<cfset subtot = subt>
is fine - the pound signs are unnecessary there too, but there again
the whole assignment is unnecessary as you can just use subt in your
query.
On 12/14/05, eric.creese <[EMAIL PROTECTED]> wrote:
> Okay I create ashort but sweet order form. Esentailly I have a numeric ID 1
> through what ever associated with a product. I create the form dynamically so
> for product 1 I will have a a field for quantity called Quantity1, and a
> subtotal called Subtotal1. The problem I am having in on the action page I
> want loop the items into a Order Items table only if the quantity is greater
> that zero. But where I am really blowing up is that I am trying to
> dynamically create the form names Quantity1 and Subtotal1 for the insert and
> I am blowing up. Here is what I gopt so far. Note getprods is a simply a
> query to my products table where I grab the itemid in sequential order.
>
> <cfloop query="getprods">
>
> <cfset fid = 'form.quantity'&ToString(#itemid#)>
>
> <CFIF fid NEQ 0>
>
> <cfset subt = 'Subtotal'&ToString(#itemid#)>
> <cfset subtot = #subt#>
>
>
> <cfquery name="ins" datasource="#dbname#">
> INSERT INTO orderitems
> (orderid,itemid,subtotal,qty)
> VALUES
> ('#getmx.orderid#',#itemid#,#subtot# ,#fid#)
> </cfquery>
> </CFIF>
> </cfloop>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226989
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54