If a checkbox is "unchecked" no field name is sent as a variable. Check for
it's existence either like the below example, or by using CFPARAM on the
action page with a default of "no" then check for its existence and skip
the <CFELSE> block
<td><INPUT type="Checkbox" NAME="field1" value="yes"checked="yes"></td>
<cfif isdefined("form.field1")>
<CFSET field1 = "yes">
<CFELSE>
<CFSET field1 = "no">
</CFIF>
<cfquery name="qInsert" datasource="landlord2">
insert into table1
(Field1)
values
('#Field1#')
</cfquery>
Shane
----- Original Message -----
From: "mohammed jakda" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 27, 2000 3:13 PM
Subject: Checkbox prob...
> Hi,
> I have a single checkbox field on a form for a user to check or uncheck if
> they want to subscribe to a newsletter, the problem I'am having is that if
> the user unchecks it, then my insert query does not record anything such
as
> no or 0 in my Dbase column, whereas as if it is left at the default
checked
> it store the value "yes" in the Dbase...
> Does anyone know how to make a value be stored in the Dbase when a user
> unselects the checkbox???
>
> <td><INPUT type="Checkbox" NAME="field1" value="yes"checked="yes"></td>
>
> <cfif isdefined("form.field1")>
> <cftransaction>
> <cfquery name="qInsert" datasource="landlord2">
> insert into table1
> (Field1)
> values
> ('#form.Field1#')
> </cfquery>
> </cftransaction>
> </cfif>
>
> Regards.
>
> Parsman.
>
>
>
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
> --------------------------------------------------------------------------
----
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
>
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.