/** * Creates a new Questionnaire model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Questionnaire(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
public function actionCreate() { $model = new Questionnaire(); if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->session->addFlash('success', Yii::t('app', "Record was successfully created.")); return $this->redirect(['view', 'id' => $model->id_ank]); } else { return $this->render('create', ['model' => $model]); } }
public function actionIndex() { if (array_key_exists('lang', $_GET)) { Yii::$app->language = $_GET['lang']; } else { Yii::$app->language = 'en'; } $model = new Questionnaire(); if ($model->load(Yii::$app->request->post())) { // get multiple clothing options if (is_array($model->clothing)) { $model->clothing = join(",", $model->clothing); } // save to database if ($model->save()) { return $this->render('success'); } } return $this->render('index', ['model' => $model]); }