In Create Replace Textbox With Dropdown Box

For the words table:

the _form has auto generated the code

<div class="row">


	<?php echo $form->labelEx($model,'tagId'); ?>


	<?php echo $form->textField($model,'tagId'); ?>


	<?php echo $form->error($model,'tagId'); ?>


</div>

here i want to replace the textbox {$form->textField($model,‘tagId’);} with dropdown box which will get data from tbl_tags table and create the drop down like the following

<option value="tagsId">tags</option>

Thanks in advance

<?php echo $form->dropDownList($model,‘tagid’, CHtml::listData(Tags::model()->findAll(),‘id’,‘name’)); ?>

this assumes your primarykey field is named id and the the data you want to display in your dropdown is called name in your db

thanks, now i understand how to use this.