How can I insert data from a cfloop?
I have a query that outputs into a cfloop. What I need it to do is insert into an access database when the changes have been made. I have looked at several tutorials but they all offer different solutions than what I am looking for. My cflloop is:
<cfoutput>
<cfloop query="update" >
<tr>
<td><input type="text" name="meeting_date" value="#meeting_date#" /></td>
<td><input type="text" name="contact_first" value="#update.contact_first#" /></td>
<td><input type="text" name="contact_last" value="#update.contact_last#" /></td>
<td>Attended <input type="checkbox" name="attended" value="yes" /></td>
<td><input type="text" name="leads" size="3" /></td>
</tr>
</cfloop>
</cfoutput>
I then try to insert into the database with:
<cfset j = "1">
<cfloop index="i" from="1" to="#update.recordcount#">
<cfset meeting_date = "Form.i#j#">
<cfset contact_first = "Form.i#j#">
<cfset contact_last = "Form.i#j#">
<cfset attended = "Form.i#j#">
<cfset leads = "Form.i#j#">
<cfset meeting_date = Form["i#j#"]>
<cfset contact_first = Form["i#j#"]>
<cfset contact_last = Form["i#j#"]>
<cfset attended = Form["i#j#"]>
<cfset leads = Form["i#j#"]>
<cfquery datasource="#application.Database#">
INSERT INTO quarterly (meeting_date, contact_first, contact_last, attended, leads)
VALUES ('#meeting_date#', '#contact_first#', '#contact_last#','#attended#',leads)
</cfquery>
<cfset j=j+1>
</cfloop>
Any ideas as to how to get my cfloop to insert into my database? I don't think I can lose anymore sleep over this. Thanks,
