Php 关于URL中参数的疑问

Php 关于URL中参数的疑问,php,yii2,Php,Yii2,本人将以下表格寄至以下地址: http://localhost/myapp/web/index.php?r=cashbook%2Faccomplishment 谁处理并生成以下URL: http://localhost/myapp/web/index.php?r=cashbook%2Faccomplishment&Cashbook%5Bcategory_id%5D=18 但我只需要在dropDownList中选择的category_id值。也就是说,URL应该是: http://loc

本人将以下表格寄至以下地址:

http://localhost/myapp/web/index.php?r=cashbook%2Faccomplishment

谁处理并生成以下URL:

http://localhost/myapp/web/index.php?r=cashbook%2Faccomplishment&Cashbook%5Bcategory_id%5D=18
但我只需要在dropDownList中选择的category_id值。也就是说,URL应该是:

http://localhost/myapp/web/index.php?r=cashbook%2Faccomplishment&category_id=19
如何保持这种状态或仅获取视图中的类别id添加注册表:

不要使用ActiveForm::begin。。。还有你所有的代码。不要使用这个:

echo Html::activeDropDownList($model, 'id_category', ArrayHelper::map(
            Category::find()->where(['user_id' => Yii::$app->user->identity->id])
                            ->orderBy("desc_category ASC")
                            ->all(), 'id_category', 'desc_category'), ['onchange'=>'submit(this.value);','prompt'=>'-- Select --']);
当我从/?category\u id=更改为&category\u id=时工作。非常感谢你
$this->registerJs('var submit = function (val){
if (val > 0) {
    window.location.href = "' . Url::to(['/cashbook/accomplishment']) . '/?category_id=" + val;
}
}', View::POS_HEAD);
echo Html::activeDropDownList($model, 'id_category', ArrayHelper::map(
            Category::find()->where(['user_id' => Yii::$app->user->identity->id])
                            ->orderBy("desc_category ASC")
                            ->all(), 'id_category', 'desc_category'), ['onchange'=>'submit(this.value);','prompt'=>'-- Select --']);