checkbox_state
function checkbox_state($state)
Returns checked="checked" string if the parameter value is TRUE. Use this function to program form checkboxes.
Parameters
- $state - boolean. Specifies checkbox current state.
Return value
Returns string value.
Examples
The following code creates a checkbox with name "extra option". The checkbox is automaticall checked if the POST array contains 'extra_option' element and its value is TRUE.
<input name="extra_option" <?= checkbox_state(post('extra_option')) ?> value="1" type="checkbox"/>Next: content_block
Previous: Reference
Return to Reference

