Select Dropdownbox No Change Value

Dear all,

I have the page of product which have one category, in product page, I have category which load from category talbe like this:


<?php $form=$this->beginWidget('CActiveForm', array(

	'id'=>'services-form',

	'enableAjaxValidation'=>false,

	'enableClientValidation' => true,	

	'htmlOptions' => array('enctype' => 'multipart/form-data'),

)); ?>


<div class="row">

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

		<?php

			 $list = CHtml::listData(Categories::model()->findAll(array('order' => 'cate_name')), 'id', 'cate_name');

   			echo $form->dropDownList(Categories::model(), 'id', $list);

		?>

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

	</div>


<?php $this->endWidget(); ?>

and the dropdownbox show like this:


<select id="Categories_id" name="Categories[id]">

 <option value="4">Additional Services</option>

 <option value="6">Chidren Menu</option>

</select>

I get model like this:


$model->attributes=$_POST['Services'];

when I select any value in dropdownbox,it always returns value 2,it is value category of product in database

when I select any dropdownbox value, it always return value in database, it not get value from dropdownbox ? why it happen ?how to fix it,

thankyou

I believe this is where you problem is


// is not this suppose to be categories field from the form

$model->attributes=$_POST['Services'];

thankyou very much, to get category in dropdownbox with this line:

$ser_cate = $_POST[‘Categories’][‘id’];