Liam Delahunty: Home Tips Web Contact
Recommended laptop
under £500
.

Think I deserve a present? See my Amazon Wish List

Checkbox

Put the following function in the php code:
 
function docheckbox($events, $boxvalue){
    $events = is_array($events) ? $events : array();
    $displayvalue = htmlentities($boxvalue);
    $comparevalue = get_magic_quotes_gpc() ? addslashes($boxvalue) : $boxvalue;
    $checked = in_array($comparevalue, $events, true) ? 'checked' : '';
    printf('<input type="Checkbox" name="events[]" value="%s" %s>', $displayvalue, $checked);
}

Call it with:
docheckbox($events, "Name of Thing");

Share this!