When you do the database update, you'll have to run the select query again and then use... <cfoutput query="jss"> <cfset theSubCat = #Evaluate("form." & SUBCAT)#"> </cfoutput>
<cfquery name="insert_details"> INSERT INTO METADATA (ID, KEY, VALUE) VALUES ('#ID#', '#theSubCat#','#hello#') </cfquery> Chris Martin ------------------------------------------- Gandy Ink Information Technology Department [EMAIL PROTECTED] (325) 949-7864 X-364 ------------------------------------------- www.gandyink.com Hugh Fidgen wrote: > Hiya, > > I'm trying to create a query based form which reads it's elements from a > database table, then populates itself. Each input element would have be > dynamically named via the DB query. > > Creating the form isn't so bad, but handling the insert query the other side > is becoming a headache. I can't figure out how to recreate the dynamic names > of the form variables and extract their data for insertion into the DB. > > If that makes little sense i apologise, but here is an example of what i'm > trying to achieve: > > Query code > ***************************** > name="jss" > SELECT SUBCAT > FROM JSS > ORDER BY SUBCAT ASC > > > Form code > ****************************** > <tr><cfoutput query="jss"><td>#SUBCAT# <cfinput type="checkbox" > name="#SUBCAT#" checked="no" value="1"></td></cfoutput></tr> > > > Form validation & SQL input query code > ************************************************ > <cfoutput query="jss"> > <cfset hello = "FORM.#SUBCAT#"> > <cfif #hello# eq '1'> > <cfquery name="insert_details"> > INSERT INTO METADATA (ID, KEY, VALUE) > VALUES ('#ID#', '#JSS_SUBCAT#','#hello#') > </cfquery> > </cfif> > </cfoutput> > > > Now obviously at the moment #hello# outputs as "FORM.A1" or whatever the > #SUBCAT# variable held. What I need is a way of re-creating those variable > names outside of the form structure, and then using these variable names to > actually pull the data from the form submission. > > Thanks a lot for any help, > > H > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Check out the new features and enhancements in the latest product release - download the "What's New PDF" now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:287443 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4