rendered paste bodyclass htmlSelect {
var $name;
var $options;
var $values;
var $selected;
var $class;
function htmlSelect ( ) {
//
}
function output ( ) {
if ( count($this->$options) == 0 ) {
return '<b>htmlSelect Error : No options supplied for select element.</b><br>';
}
if ( count($this->$values) == 0 ) {
return '<b>htmlSelect Error : No options supplied for select element.</b><br>';
}
if ( count($this->$options) != count($values) ) {
return '<b>htmlSelect Error : Unequal number of options and values.</b><br>';
}
if ( empty($class) ) {
$output = '<select name="' . $name . '">';
} else {
$output = '<select name="' . $name . '" class="' . $class '">';
}
$output .= '</select>';
return $output;
}
}
$htmlSelect = new htmlSelect;
echo $htmlSelect->output();