set_checkbox()

set_checkbox($field[, $value = ''[, $default = FALSE]])

Parameters:
  • $field (string) – Field name
  • $value (string) – Value to check for
  • $default (string) – Whether the value is also a default one
Returns:

‘checked’ attribute or an empty string

Return type:

string

Permits you to display a checkbox in the state it was submitted.

The first parameter must contain the name of the checkbox, the second parameter must contain its value, and the third (optional) parameter lets you set an item as the default (use boolean TRUE/FALSE).

Example:

<input type="checkbox" name="mycheck" value="1" <?php echo set_checkbox('mycheck', '1'); ?> />
<input type="checkbox" name="mycheck" value="2" <?php echo set_checkbox('mycheck', '2'); ?> />
doc_CodeIgniter
2016-10-15 16:32:38
Comments
Leave a Comment

Please login to continue.