Question
The Array Insertin Loop
I am trying to insert the values in the database where one
value is just like ID of the form and other values are based on the
checkbox values. I dump the data and they appear as:
struct
FIELDNAMES SELEMAILS,THELISTVAL
SELEMAILS 4,3,5,6
THELISTVAL 16
array
1 4
2 3
3 5
4 6
So the above SELEMAILS value was coming as list and i converted this to array.
and there after i want to insert the data in the database.
but i am stuck in inserting.
I want to loop over the array and then insert the value but i do not know how
Also the checkbox will increase if i select more checkboxes, and how will i insert the value 16 for that.
Like i want my database to appear like this:
eid checkboxid
16 3
16 4
16 5
16 6
and if list of checkboxes increase, the dynamic eid value should alo increase.
I am creating something like this:
<cfform method="post" action="do.cfm">
<tr> <cfoutput>
<div>Displaying <b>#URL.startRow#</b> to <b>#endRow#</b> of <b>#totalRows#</b> Records</div>
</cfoutput>
<div align="left">
<!---<cfinclude template="nextn.cfm">--->
</div>
<cfloop query="qUsers" startRow="#URL.startRow#" endrow="#endRow#">
<cfoutput>
<cfif variables.newrow EQ true>
<tr>
</cfif>
<td align="LEFT">
<CFINPUT type="checkbox" name="selEmails" value="#userid#" required="yes" message="Select least 1 to continue." tooltip="Choose Emails to send the Event Letter">
<cfif session.mytype EQ 'admin' OR session.mytype EQ 'moderator'><cfelse>
<a href="mailto:#useremail#">#FullLeft(useremail,10)#...</a></cfif> </td>
<cfif qUsers.currentRow MOD 4 EQ 0>
</tr>
<cfset variables.newrow = true>
<cfelse>
<cfset variables.newrow = false>
</cfif>
</cfoutput>
</cfloop>
</tr>
<input type="hidden" name="theListVal" value="<cfoutput>#form.thespecificevents#</cfoutput>">
<tr><td colspan="4"> </td></tr>
<tr>
<td colspan="4"><input type="submit" value="Send to Checked Email Addresses" tabindex="1" class="longPost" onMouseOver="this.className='longPost_over'" onMouseOut="this.className='longPost'" /></td>
</tr>
</cfform>
Well can Someone Plz Guide me in this?
struct
FIELDNAMES SELEMAILS,THELISTVAL
SELEMAILS 4,3,5,6
THELISTVAL 16
array
1 4
2 3
3 5
4 6
So the above SELEMAILS value was coming as list and i converted this to array.
and there after i want to insert the data in the database.
but i am stuck in inserting.
I want to loop over the array and then insert the value but i do not know how
Also the checkbox will increase if i select more checkboxes, and how will i insert the value 16 for that.
Like i want my database to appear like this:
eid checkboxid
16 3
16 4
16 5
16 6
and if list of checkboxes increase, the dynamic eid value should alo increase.
I am creating something like this:
<cfform method="post" action="do.cfm">
<tr> <cfoutput>
<div>Displaying <b>#URL.startRow#</b> to <b>#endRow#</b> of <b>#totalRows#</b> Records</div>
</cfoutput>
<div align="left">
<!---<cfinclude template="nextn.cfm">--->
</div>
<cfloop query="qUsers" startRow="#URL.startRow#" endrow="#endRow#">
<cfoutput>
<cfif variables.newrow EQ true>
<tr>
</cfif>
<td align="LEFT">
<CFINPUT type="checkbox" name="selEmails" value="#userid#" required="yes" message="Select least 1 to continue." tooltip="Choose Emails to send the Event Letter">
<cfif session.mytype EQ 'admin' OR session.mytype EQ 'moderator'><cfelse>
<a href="mailto:#useremail#">#FullLeft(useremail,10)#...</a></cfif> </td>
<cfif qUsers.currentRow MOD 4 EQ 0>
</tr>
<cfset variables.newrow = true>
<cfelse>
<cfset variables.newrow = false>
</cfif>
</cfoutput>
</cfloop>
</tr>
<input type="hidden" name="theListVal" value="<cfoutput>#form.thespecificevents#</cfoutput>">
<tr><td colspan="4"> </td></tr>
<tr>
<td colspan="4"><input type="submit" value="Send to Checked Email Addresses" tabindex="1" class="longPost" onMouseOver="this.className='longPost_over'" onMouseOut="this.className='longPost'" /></td>
</tr>
</cfform>
Well can Someone Plz Guide me in this?
