DropDownList of all countries

Hi all. I want to create a dropDownList of countries in Yii, but I find too difficult to create a raw list of all this in my code.

Can anybody help me find an easy way to fix this ?

Try like this -

// retrieve the models from db

$models = countries::model()->findAll(

                 array('order' => 'country_name'));


// format models as $key=>$value with listData

$list = CHtml::listData($models, 

                'country_id', 'country_name');


//Make Drop-down list				

echo CHtml::dropDownList('countries', $countries, 


              array('empty' => '-- Select Country --'));

for more help visit - http://www.yiiframework.com/wiki/48/by-example-chtml#hh5