|
Can alternatively use this function that will allow for multiselect checkboxes too. Will need to modify the form handling to process these elements as an array.
//print a radio button or checkbox
function input_radiocheck($type, $element_name, $values, $element_value) {
print '<input type="' . $type . '" name="' . $element_name .'[]" value="' . $element_value . '" ';
if (in_array($element_value , $values[$element_name])) {
print ' checked="checked"';
}
print '/>';
}
Usage:
input_radiocheck('checkbox','contact', $_POST, 'email');
input_radiocheck('checkbox','contact', $_POST, 'mail');
input_radiocheck('checkbox','contact', $_POST, 'phone');
|