system: Linux mars.sprixweb.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
<?
class Lib_Components
{
function createComponent($type,$values,$att,$default=0)
{
if($type=="combobox")
{
if(is_array($values))
return $this->createComboBox($values,$att,$default);
else
return false;
}
}
function createComboBox($values,$att,$default)
{
$component = '<select '.$att.'>';
foreach($values as $key=>$item)
{
$component .= '<option value="'.$key.($key==$default ? '" selected' : '').'">'.$item.'</option>';
}
return $component .= '</select>';
}
}
?>