public function actionAdd() { $model = new Tareas(); if (isset($_POST['Tareas'])) { $model->attributes - $_POST['Tareas']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('add', 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 Tareas(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Tareas'])) { $model->attributes = $_POST['Tareas']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
public function actionAdd() { $model = new Tareas(); if (isset($_POST['Tareas'])) { // valkidamos si trae algun valor en el formulario $model->attributes = $_POST['Tareas']; // se asignan los valores del formulario a la clase modelo if ($model->save()) { // esto es como hacer un UPDATE tareas... WHERE id = {el ide que trae la accion} $this->redirect(array('view', 'id' => $model->id)); } // esto es como hacer un header location en el caso que guarde } $this->render('add', array('model' => $model)); }