I always delete ALL previous selections from the DB and then insert the new ones...that way everything stays current and the coding is dead simple.
HTH Bryan Stevenson B.Comm. VP & Director of E-Commerce Development Electric Edge Systems Group Inc. t. 250.920.8830 e. [EMAIL PROTECTED] --------------------------------------------------------- Macromedia Associate Partner www.macromedia.com --------------------------------------------------------- Vancouver Island ColdFusion Users Group Founder & Director www.cfug-vancouverisland.com ----- Original Message ----- From: "Tony Carcieri" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Monday, October 07, 2002 10:39 AM Subject: I lost my brain - checkboxes > Hi all, > > Sorry for the stupid post today but I cannot think. > > I have an input field on a form: > <input type="checkbox" name="hotlead" value="<cfoutput>#SID#</cfoutput>"> > (SID is the primary key in the SQL 2K DB). > > then on the page: > <cfloop query="GetInfo"> > <tr> > <td><input type="checkbox" name="hotlead" > value="<cfoutput>#SID#</cfoutput>" <cfif Hot EQ 1>checked</cfif></td> > </tr> > </cfloop> > > So here is my problem. When a checkbox (or more) is checked, I do this SQL > statement: > UPDATE survey SET Hot = 1 WHERE SID IN (10,17) and this works great. > However, if I deselect the checkbox I no longer have the SID: > UPDATE survey SET Hot = 1 WHERE SID IN 0 (makes sense the value is the SID). > > So how do I do this? > I want to set the Hot field to 1 on only the SID when checked and if i > deselect it, then i want the field to be set to 0 on the SID i deselect. The > default value in the Hot (bit) field is 0. > > Thanks, > Tony > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm