Hello friends,
I have a dropDownList, i need to get id from selected value. how can i do that in my controller class.
my dropDownList code:
<?php
$form = ActiveForm::begin([
'action' => 'index.php?r=profile/assign-module']); ?>
<?= $form->field($re_users, 'Fname')->dropDownList(
ArrayHelper::map(Users::find()->where(['role' => 'Student'])->all(),
'id','Fname'),
[
'prompt'=>'Select Student', 'id'
],
['options' =>
[$_GET['Fname'] => ['Selected'=>'selected']]
]
);
?>
my controller class :
public function actionAssignModule() {
$user_module = new UserModule();
if (Yii::$app->request->post())
{
$name = $_GET['id'];
die($name);
}
}