I’d like to print something like “yes, checked” if a cck single checkbox is checked.
The single on/off checkbox has allowed values of no and yes.
checkbox info is –
<input type="checkbox" class="form-checkbox" checked="checked" value="yes"
id="edit-field-billing-terms-value" name="field_billing_terms[value]">
I’m trying, and failing with modifications of this code –
<?php
$node->field_billing_terms[value] . '<br />';
if($node->field_billing_terms[value] == 'yes' ) {
print "yes, checked";
}
?>
Can someone give me some pointers where I’m going wrong? More info can be provided if needed.
Fields are normally in a zero based array when attached to the node object, this should fix your problem: