echo CHtml::listBox('listBoxName', null, array('Item 1', 'Item 2', 'Item 3', 'Item 4') );
$data = CHtml::listData(Customer::model()->findAll(), 'id', 'name'); echo CHtml::listBox('listBoxName', null, $data);In this example, the listBoxName will be populated by retrieving data from a database table named Customer. The first parameter is the attribute name for the value of each item, and the second parameter is the attribute name for the label of each item. The CHtml::listData method maps the retrieved data into an array for the list box. Package library: CHtml is a part of the Yii PHP framework.