Here's an example of what I use in an AfterAdd or AfterEdit Event:
// Get Database Connection...
global $conn; // Get current Table Name...
$strTableName = substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1); // Retrieve Checkbox State from the Form and Store in Active Database...
if($values['checkboxfieldname'] == 1) // The CheckBox is Checked...
{
strSQLUpdate="UPDATE ".$strTableName." SET checkboxfieldname = 1 WHERE ".$where.";";
db_exec($strSQLUpdate,$conn);
// and/or perform some other action...
}
else // The CheckBox is not CheckBox...
{
strSQLUpdate="UPDATE ".$strTableName." SET checkboxfieldname = 0 WHERE ".$where.";";
db_exec($strSQLUpdate,$conn);
// and/or perform some other action...
}
J
Jane12/22/2009
Hi, just set up this field as Checkbox on the "View as" settings/"Edit as" settings dialogs on the Visual Editor tab.