Dropdownlist Selected value

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:


                        $form = ActiveForm::begin([

                                 'action' => 'index.php?r=profile/assign-module']); ?>


                           <?= $form->field($re_users, 'Fname')->dropDownList(

                              ArrayHelper::map(Users::find()->where(['role' => 'Student'])->all(),



                                        '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'];




I don’t know where to begin, but I can tell you that you do need to sit down and learn how Yii works.

Controllers and actions, models and data,views,widgets and forms.

Because that code is simply not Yii all.

Read, breathe and live the guide.

thanks Mr Elite, personally i found the solution.

in my controller class i should want to add one line of code.

 if ([b]$re_users->load[/b](Yii::$app->request->post())) 


       $studentID = $re_users->Fname;


i want to load my model to catch POST request.

when i’m debuging i found post request successfully send the request into controller. by using this code

 print_r($_POST); die();