php - syntax error, unexpected '$model' (T_VARIABLE) form yii2 -


i'm beginner learn yii2.

i getting error:

syntax error, unexpected '$model' (t_variable) form yii2

here code:

public function actionforms(){     $model = new form11();  // <<error on line     if ($model->load(yii::$app->request->post()) && $model->save()) {         yii::$app->session->setflash('contactformsubmitted'); 

check 2 things ...

  1. you have created model named form11 in /models directory. (with name space)
  2. include model in controller file.

Comments

Popular posts from this blog

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

c# - Populating Gridview inside Listview ItemTemplate On Web User Control from Code Behind -