Код: Выделить всё
<?php
$form = ActiveForm::begin(); ?>
<?php $items = \app\models\Country::find()
->select(['name'])
->where(['between', 'population', '200000000', '20000000000'])
->indexBy('name')
->column();
$params = [
'prompt' => 'любой'
];
echo $form->field($country, 'name')->dropDownList($items, $params);
?>
<p><a href="<?= \yii\helpers\Url::to(['country/find','country-name'=>'value']) ?>">Выбрать</a></p>
<?php
ActiveForm::end();
?>
Код: Выделить всё
public function actionFind ()
{
$qu = trim(Yii::$app->request->post('country-name'));
// $search= Yii::$app->$request->get('country-name');
return $this-> render('find', ['qu'=>$qu] );
}
Код: Выделить всё
<form id="w0" action="/~svetlanailina/yii3/web/index.php?r=country%2Findex" method="post">
<input type="hidden" name="_csrf" value="P4HagygLXqS6owMw9M6HzpHqCSzfKf2ySnH3pQVOghFT4r_iW20a6fSQVgmthsqaw9NLarROn_gvHI_GX37kZg==">
<div class="form-group field-country-name">
<label class="control-label" for="country-name">Name</label>
<select id="country-name" class="form-control" name="Country[name]">
<option value="">любой</option>
<option value="Brazil">Brazil</option>
<option value="China">China</option>
<option value="India">India</option>
<option value="United States">United States</option>
</select>
<div class="help-block"></div>
</div><p><a href="/~svetlanailina/yii3/web/index.php?r=country%2Ffind&country-name=value">Выбрать</a></p>
</form>