Value From Dropdownlist Not Being Inserted Into The Database

Hello Yii forumers!

I am currently learning Yii/building a site and I have encountered a problem. I have a form that has 3 dropdown lists, depending on what you select in the first one, the next two are auto-populated, and this works fine. But when I go to submit my form to the database, the first dropDown value is shown as ‘NULL’ and I am not sure why. The first dropdown is CHTML dropdown, and the next is $form->dropDown, I think this might make a difference but I am not sure why because I thought I was still referencing the dropDown correctly and this would be picked up by the form. Can anyone tell me what I am doing wrong? Thank you very much!

Here is my first two drop downs, the third is the same as the second

<div class="row">

		<?php echo CHtml::dropDownList('competition','', Competitions::model()->getAllCompetitions(),


			'ajax' => array(

				'type'=>'POST', //request type

				'url'=>CController::createUrl('fixtures/Dynamiccompetitions'), //url to call

				'update'=>'#'.CHtml::activeId($model, 'home_team').', #'.CHtml::activeId($model, 'away_team'),



	); ?>

<div class="row">

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

		<?php echo $form->dropDownList($model,'home_team', array('empty'=>'--Select a Team--')); ?>


just in case you need to see my dynamiccompetitions!

public function actionDynamiccompetitions()


		$id = $_REQUEST['competition'];




	    foreach($data as $value=>$name)


	        echo CHtml::tag('option',




Please show the model that receive the data form and stores the data.

Seems like you should be using CHtml::activeDropDown

If I change it to activeDropDownList, it then does not update my other drop down lists.

You see after in this line,


the empty ‘’, what is this representing? I did this based on this