How can i retain and show a selected value from a dropdownList in itself after reloading the page until it would be changed again by user?

In my View


<?php $searchModel = new AgahiSearch();?>

            <?php $form = ActiveForm::begin([

                'action'=>['site/search'],

                'method'=>'get',

                'options' => ['data-pjax' => true ]

            ]);?>

<?php $catobject = new Category();?>

                    <?php $a = ArrayHelper::map(Category::find()->where(['parent_id'=>'y'])->All(),'id','name');?>

                    <?= $form->field($catobject, 'parent_id')->dropDownList($a, [

                        'id'=>'cat-id',

                        'prompt'=>' select your group ',

                        'options' =>['data-pjax' => true ]


                    ]);?>



in my Model


public function search($params)

    {

        $query = Agahi::find();

        $dataProvider = new ActiveDataProvider([

            'query' => $query

        ]);

        if (!($this->load($params) && $this->validate())) {

            return $dataProvider;

        }


        $query->andfilterWhere(['like','title', $this->title])

        ->andFilterWhere(['in','type_id',$this->type_id])

        ->andFilterWhere(['in','cat_id',$this->cat_id]);


        return $dataProvider;

    }

in my Controller


 public function actionSearch()

    {

        $searchModel = new AgahiSearch();

        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);

        $modelCatsite= Category::find()->where(['parent_id'=>'y'])->All();


        return $this->render('index', [

            'dataProvider' => $dataProvider,

            'modelCatsite' => $modelCatsite,

           

        ]);

    }

Well,

One solution is not to reload page (e.g. to use ajax or popup page to update model data).

Another solution is to store search criteria in a cookie or session and apply them to search model before loading request arguments.