LuisRox
LuisRox

Reputation: 67

yii2: how to send a model from a create form to the controller

I have a dropdownlist in my form:

<?= Html::activeDropDownList($model, 'Id_tipoprograma',
  ArrayHelper::map(Tipoprograma::find()->all(), 'Id_tipoprograma', 'Id_tipoprograma', 'Descripcion'))?>

i want to receive "Id_tipoprograma" in the controller, i tried with:

$idtp = $model->Id_tipoprograma;    

But doesn't work. thanks.

Upvotes: 0

Views: 572

Answers (1)

Tahir
Tahir

Reputation: 733

First read docs here and here. Normally you should get form data in Yii::$app->request->post() or Yii::$app->request->get()

Upvotes: 1

Related Questions