in the form's action page, loop through #form.fieldnames#, if the
fieldname starts with "qty_" and has a value - get the prodid from field
name using removechars() or listlast() and update the db. something like
this:

<cfloop list="#form.filednames#" index="field">
<cfif left(field, 4) is "QTY_" AND int(val(form[field])) GTE 1>
<cfquery datasource="...">
INSERT INTO yourtable
(product_id
, quantity)
VALUES
(
  <cfqueryparam cfsqltype="cf_sql_integer" value="#listlast(field, "_")#">
, <cfqueryparam cfsqltype="cf_sql_integer" value="#form[field]#">
)
</cfquery>
</cfif>
</cfloop>

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/



Sham Rock wrote:
> I have a form that is using a cfloop query to produce a input field for 
> productid quantity. It can produce several input fields depending on the 
> query.
> Example -
> <td><input type=text size=3 name="QTY_<cfoutput>#prodid#</cfoutput>"></td>
> In the submit processing page I need to take the productid's that have a 
> value to insert into the database.
>
> I have created a list (Plist) from the form submitted,
> Plist===QTY_101,QTY_102,QTY_103
>
> Then I loop through to take out only the fields that have a value, <cfloop 
> list="#plist#" index="z">
>   <cfif evaluate("form.qty_#z#") GTE 1>
>         <cfoutput>#z#-#evaluate("form.qty_#z#")# <br /></cfoutput>
>               <cfset zlist = #evaluate("form.qty_#z#")#>
>               <cfset zlist = ListAppend(zlist, "#z#")>
>   </cfif>
> </cfloop>
> The problem I am having is how do I make a list so when i do the update query 
> I can insert the product id and the quantity. 
>
>   

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:316309
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to