inputCheckbox example

Simple checkboxes, one with a default value and the other without. Clonefish also takes care of the unique behaviour of the checkboxes: they're not present in the GET/POST arrays when the form is submitted and the checkbox was not checked. In clonefish, you may set up an "off value" for the checkbox inputs: the form element will contain this value when the checkbox was unchecked. It's never been easier creating a database insert of your form! Compare the values of the $_POST array and the results of a $clonefish->getElementValues() call below the form!

The live form - submit it!

Data dump

Below are the dumps of some PHP variables - submit the form to see the changes!

Contents of the $_POST array:
$_POST = array (
)

Results of a $clonefish->getElementValues() call:
array (
  'newsletter' => 0,
  'marketing' => 'Y',
)

There are cases when the above arrays are different. This is not a bug, but a feature: clonefish was written to help with everyday form hassles (like avoiding the missing value of an unchecked checkbox or compiling the whole date string from date selector fields).