All pastes #186371 Raw Edit

Stuff

public php v1 · immutable
#186371 ·published 2006-09-29 21:00 UTC
rendered paste body
$departments = array('or' => 'OR',							  'preop' => 'PREOP',							  'pacu' => 'PACU',							  'colon' => 'COLON',							  'pain' => 'PAIN',							  'ecc' => 'ECC',							  'eyes' => 'EYES',							  'boffice' => 'Business Office',							  'facops' => 'FACOPS');function input_select($element_name, $selected, $options, $multiple = false) {    // print out the <select> tag    print '<select name="' . $element_name;    // if multiple choices are permitted, add the multiple attribute    // and add a [] to the end of the tag name    if ($multiple) { print '[]" multiple="multiple'; }    print '">';    // set up the list of things to be selected    $selected_options = array();    if ($multiple) {        foreach ($selected[$element_name] as $val) {            $selected_options[$val] = true;        }    } else {        $selected_options[ $selected[$element_name] ] = true;    }    // print out the <option> tags    foreach ($options as $option => $label) {        print '<option value="' . htmlentities($option) . '"';        if ($selected_options[$option]) {            print ' selected="selected"';        }        print '>' . htmlentities($label) . '</option>';    }    print '</select>';}input_select('department', $_POST, $GLOBALS['departments']);