Rather than use the DE function, just place the form.ingredients inside
single quotes:
    <cfset Measurement = Evaluate('form.IngredientMeasurement' & x)>
    <cfset Description = Evaluate('form.IngredientDescription' & x)>
What this says is, take the text value 'form.IngredientMeasurement' , append
the value of X to it and then evaluate the entire string.
Steps (assuming x=1 and 'form.IngredientMeasurement1'=test):
    'form.IngredientMeasurement' & x
    'form.IngredientMeasurement' & 1
    'form.IngredientMeasurement1'
    test

> Hello everyone.  This is my first time posting to this list, so if this
> question has been asked before, I'll apologize in advance.
> Currently, I have a page that has 16 form fields.  A user can fill out any
> number of these fields, and when the submit it, I am trying to do an
insert
> to a database only for the number of times that the form fields that the
> user filled out.  It looks something like this:
>
> <!--- Create a loop.  This loop will go through every form from the
previous
> page.  This is done for both of the forms
>     That is, for the ingredient itself, and the measurement.  --->
> <cfloop index=x from=1 to=16>
> <cfset Measurement = Evaluate(form.IngredientMeasurement & x)>
> <cfset Description = Evaluate(form.IngredientDescription & x)>
>
>
> <!--- Take the variable created by the loop, and if it is not an empty
> string, use it to update the recipe table.  This way,
>    all the steps necessary can be added to the database.  note that it
will
> not stop upon reaching a null string, it will simply
>     not do the update. --->
> <CFIF measurement NEQ "">
>         <cfquery name="qcfaddNewRecipeIngredient"
> datasource="FSLibraryTest">
>          INSERT INTO  tblRecipeIngredient (RecipeID,
IngredientMeasurement,
> IngredientDescription)
>           VALUES                          (#form.RecipeID#,
'#Measurement#',
> '#Description#')
>         </cfquery>
> </cfif>
>
> </cfloop>
>
> right now, when I try to run the template, I get an error saying the
> parameter form.ingredientMeasurement cannot be resolved.  As I am trying
to
> concatenate the variable from the loop (x)  to the string
> form.ingredientMeasurement because the forms are named
> ingredientMeasurement1, ingredientMeasurement2 and so on.  Any
> recommendations? Would DE() be a better choice to use in this case? Thanks
> in advance
>
> Chris Martin
>
>
>
> --------------------------------------------------------------------------
----
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
>

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to