i am using a dependent dropdown list but the id i pass to the action make it 'id'
how to avoid this any one know about this
here is my code
View
<?= $form->field($model, 'fld_material_id')->dropDownList(ArrayHelper::map(Material::find()->all(), 'fld_id','fld_name'),['style'=>'width:18%;', 'prompt'=>'-Choose a Material-',
'onchange'=>'
alert(this.value);
$.post( "'.Yii::$app->urlManager->createUrl('product/list?id=').'"+$(this).val(), function( data ) {
$( "select#fld_size_id" ).html( data );
});
']); ?>
Controller
public function actionList($id)
{
// echo "$id ";exit;
$countPosts = Size::find()->where(['fld_material_id' => $id])->count();
$sizes = Size::find()->where(['fld_material_id' => $id])->orderBy('id DESC')->all();
if($countPosts>0){
foreach($posts as $post){
echo "<option value='".$post->id."'>".$post->title."</option>";
}
}
else{
echo "<option>-</option>";
}
}
the error is