ajaxCRUD.com

» a PHP class to Create, Read, Update, & Delete from a mysql database table using AJAX

   by loud canvas media

AjaxCRUD Class Documentation / Reference Material

<< Reference overview
<< Home

defineCheckbox

Sets the field to be of type 'checkbox'.
void defineCheckbox ( String fieldName, [ String value_on], [String value_off] )
Use this function if you have an on/off or yes/no type of field (two options). As such you want a simple checkbox to toggle between the options.

The default value for checked (on) is 1 and unchecked (off) is 0. However, you can set your own values, with the two optional parameters.

Details

Type function
Returns void
Default 1,0

Parameters

fieldName
The database field name
(optional) value_on
The value set when the checkbox is checked (default is 1)
(optional) value_off
The value set when the checkbox is unchecked (default is 0)

Example

//this will set 1 for checked and 0 for unchecked (perfect if your field is an INT or TINYINT)
$tblDemo->defineCheckbox("fldHasAHome");

//this will define it so that "on" is for checked and "off" is for unchecked
//(obviously you want to use a varchar or a text now)
$tblDemo->defineCheckbox("fldILeftTheStove", "on", "off");

See also

New, Edit

 

"...first of all great work! :) Really smooth operation and deployment."
~Jonathan

What is a business/commercial website?

A commercial website is one created for a business, for which purpose is generating revenue or cash flow of any type (and that isn't under a non-profit organization). So if you're selling a product, selling advertisement, selling a service, or just marketing a commercial business, your site is commercial. A company website is also commercial even if it doesn't sell anything, as it's purpose is to front a commercial company.
Close