Hi,

I have the following form which passes any number of contentid's to the insert query. I also have a list of groupid's which need to be associated with individual contentid's. This is so that a user can assign contentid 3 groupid's 1,3,5 and at the same time assign groupid's 2,4 to contentid 2.

The form is as follows - I tried appending the contentid to the groupid so that I could sort it out in the processing page but I got lost somewhere along the way.
<form action=act_assigngroup.cfm>
<!--- This is output for each contentid from the query --->
<td><input type="checkbox" name="contentid" value="#contentid#" class="btn"></td>
<td width="100" class="list" valign="top"><cfloop query="listGroups"><input type="checkbox" name="groupid" value="#groupid#|#list_pend_content.contentid#" class="btn" <cfif groupname IS "Users">CHECKED</cfif>>#groupname#<br></cfloop></td>
</form>

In my act page I have the following which is not working:

<cfloop index="i" list="#attributes.contentid#">
<cfloop index="f" list="#attributes.groupid#" delimiters=",">
<cfif i eq ListGetAt(attributes.groupid, 2, "|")>
<cfloop index="g" list="#ListGetAt(f, 1, "|")#">
<cfquery name="assign_groups" datasource="#request.dsn#" dbtype="ODBC">
INSERT INTO content_group (contentid, groupid)
VALUES(#attributes.contentid#, '#g#')
</cfquery>
</cfloop>
</cfif>
</cfloop>
</cfloop>

As you can see a bit of a mess.

If the code worked then I should have ended up having 5 rows in the content_group table as follow:

contentid | groupid
3 | 1
3 | 3
3 | 5
2 | 2
2 | 4

Any help with this mess that I have got myself into?

Many thanks

Dave



============================================
Phipps CF Development
Oxford, Oxfordshire.
Telephone: +44(0)7718 896696
http://www.phipps-cf.co.uk
============================================


--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to