HTML_Quickform2 checkbox

As a beginner to OOP and PEAR I can create a checkbox using this code

$fieldset->addElement('checkbox', 'boxname', array('id' => 'test', 'value' => 'value'))

but how do I create the same checkbox so that the default is already checked?

Try this and see if it works:

$fieldset->addElement(‘checkbox’, ‘boxname’, array(‘id’ => ‘test’, ‘value’ => ‘value’, ‘checked’ => 'checked));