/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate() { $model = new Wishlist(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); //echo "<pre>";var_dump($_POST[Wishlist]); echo "</pre>"; die(); $flag = 0; if (isset($_POST['product_id'], $_POST['wishlist_flag'])) { $model = $model->loadWishlistModel($_POST['product_id']); //$model->attributes=$_POST['Wishlist']; if ($model == null) { $model = new Wishlist(); $model->setIsNewRecord(TRUE); } $model->wishlist_flag = $_POST['wishlist_flag'] ? 0 : 1; $model->product_id = $_POST['product_id']; if ($model->save()) { // echo "</pre>"; echo "post"; var_dump($model); die(); //echo "saved"; //$this->redirect(array('view','id'=>$model->wishlist_id)); } } $this->render('update', array('model' => $model, 'productId' => $model->product_id, 'wishlist_flag' => $flag)); }