Since you are already using digits in the form field names, you can just loop through the number of items, like:
<cfloop from="1" to="10" index="i"> <cfset ThisName = Trim(Evaluate("form.Name#i#"))> <cfset ThisAge = Trim(Evaluate("form.Age#i#"))> <cfset ThisGender = Trim(Evaluate("form.Gender#i#"))> <!--- You should probably do an if to make sure the values are not null ---> <cfquery ...> INSERT INTO .... .... VALUES ('#ThisName#', '#ThisAge#', '#ThisGender#'... </cfquery> </cfloop> >>> Jeff Fongemie <[EMAIL PROTECTED]> 04/09/02 11:46AM >>> Hello cf-talk, Is this even possible?? I have a form, that collects name, age, and gender, for a list of people. I get the it all as a form submission as in form.name1, form.age1, form.gender1, form.name2, form.age2 and so on. What I need to do, is create a new record in a parent table, to hold some other stuff for the transaction, then add each name, age and gender as a new record into a child table. THe parent record and each child record share a customerID. The parent table is easy, but I'm having trouble getting a loop to run through and insert each name,age,gender combo as a new record in the child table. This is my attempt: <!--- set up list of names to loop through ---> <cfoutput> <cfset namelist = "#form.name1#,#form.name2#,#form.name3#,#form.name4#,#form.name5#,#form.name6#,#form.name7#,#form.name8#,#form.name9#,#form.name10#,#form.name11#" > <cfset agelist = "#form.age1#,#form.age2#,#form.age3#,#form.age4#,#form.age5#,#form.age6#,#form.age7#,#form.age8#,#form.age9#,#form.age10#,#form.age11#" > <cfset genderlist = "#form.gender1#,#form.gender2#,#form.gender3#,#form.gender4#,#form.gender5#,#form.gender6#,#form.gender7#,#form.gender8#,#form.gender9#,#form.gender10#,#form.gender11#" > <!--- set up the number of items in the list so we know when to stop ---> <cfset length=listLen(nameList)> </cfoutput> THEN, I INSERT to the parent table to make a new record and get a customerID. Now the hard part: I'm having trouble getting a loop to use all three lists. Is the following even close?? <cfquery name="addmembers" datasource="pfestregistration" dbtype="ODBC"> <cfloop from="1" to="#length#" list="#namelist#"> INSERT INTO Customers_members (customerid, name, age, gender, address, address2, city, state, zip, telephone, email, emergencycontact, emergencynumber) Values ('#customerid#', '#namelist#', '#agelist#', '#genderlist#', '#form.address2#', '#form.city#', '#form.state#', '#form.zip#', '#form.telephone#', '#form.email#', '#form.emergencycontact#', '#form.contactnumber#'); </cfloop> </cfquery> Best regards, Jeff Fongemie mailto:[EMAIL PROTECTED] ------------------------ ______________________________________________________________________ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists