All pastes #133362 Raw Edit

Unnamed

public text v1 · immutable
#133362 ·published 2006-08-15 21:06 UTC
rendered paste body
class 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();