I want to use dropdownlist to display the types,
<div class="row">
<?php echo CHtml::activeLabel($model,'typeId'); ?>
<?php echo CHtml::dropDownList('typeId', 'typeId',
CHtml::listData(Type::model()->findAll(),'typeId','typeName'),
array('prompt'=>'Select a type',
'id'=>'typeId'));?>
</div>
This is the controller:
foreach($_POST[‘Shipin’] as $name=>$value)
{
if($name){
echo $name; //Nothing is output when it comes to name of dropdownlist
echo '**';
echo $value; //nothing is output when it comes to value of dropdownlist
echo ' ';
$model->$name=$value;}
}echo $_POST[‘typeId’]; //here I can get the value of the dropdownlist
in the foreach, why can’t I get the name attribute of dropdownlist? thank u