rice-daddy
02-04-2007, 12:32 AM
so im trying to update the database thru a from with checkboxes
i looked at tons of example code but its still not working. heres the code:
update form:
Smoking
<cfif #rsUnit.Smoking# is "yes">
<cfinput type="checkbox" name="Smoking" checked />
<cfelse>
<cfinput type="checkbox" name="Smoking" />
</cfif>
Kitchen
<cfif #rsUnit.Kitchen# is "yes">
<cfinput type="checkbox" name="Kitchen" checked />
<cfelse>
<cfinput type="checkbox" name="Kitchen" />
</cfif>
Action Page/Handler:
<cfif not IsDefined("Form.Smoking")>
<cfset form.Smoking = "No">
<cfelse>
<cfset form.Smoking = "yes">
</cfif>
<cfif not IsDefined("Form.Kitchen")>
<cfset form.Kitchen = "no">
<cfelse>
<cfset form.Kitchen = "yes">
</cfif>
<cfquery datasource = "u31db" name = "rsUpdate">
UPDATE tblRentalUnit
SET
Smoking='#form.Smoking#',
Kitchen='#form.Kitchen#'
WHERE UnitID='#form.UnitID#'
</cfquery>
It gives me a data type mismatch error. i have no idea whats going on please help :)
i looked at tons of example code but its still not working. heres the code:
update form:
Smoking
<cfif #rsUnit.Smoking# is "yes">
<cfinput type="checkbox" name="Smoking" checked />
<cfelse>
<cfinput type="checkbox" name="Smoking" />
</cfif>
Kitchen
<cfif #rsUnit.Kitchen# is "yes">
<cfinput type="checkbox" name="Kitchen" checked />
<cfelse>
<cfinput type="checkbox" name="Kitchen" />
</cfif>
Action Page/Handler:
<cfif not IsDefined("Form.Smoking")>
<cfset form.Smoking = "No">
<cfelse>
<cfset form.Smoking = "yes">
</cfif>
<cfif not IsDefined("Form.Kitchen")>
<cfset form.Kitchen = "no">
<cfelse>
<cfset form.Kitchen = "yes">
</cfif>
<cfquery datasource = "u31db" name = "rsUpdate">
UPDATE tblRentalUnit
SET
Smoking='#form.Smoking#',
Kitchen='#form.Kitchen#'
WHERE UnitID='#form.UnitID#'
</cfquery>
It gives me a data type mismatch error. i have no idea whats going on please help :)