$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 '; // 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 '; } print ''; } input_select('department', $GLOBALS['departments'], $_POST);