public function actionCreate() { $this->actionName = "New Data"; $model = new UserLevel(); if (isset($_POST['UserLevel'])) { $model->setAttributes($_POST['UserLevel']); if ($model->save()) { Yii::app()->user->setFlash('success', "Data saved!"); $this->redirect(array('index')); } } $this->render('create', array('model' => $model)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new UserLevel('new'); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['UserLevel'])) { $model->attributes = $_POST['UserLevel']; if ($model->save()) { Yii::app()->user->setFlash('success', 'Level "' . $model->name . '" saved!'); $model = new UserLevel('new'); } } $this->render('create', array('model' => $model)); }