/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new ItemOnOrder(); if (isset($_POST['ItemOnOrder'])) { $model->attributes = $_POST['ItemOnOrder']; $model->item_status = '1'; //since initailly ITEM is in initializing stage $model->quantity_recieved = 0.0; echo "Comments are " . $model->comments; if ($model->save()) { $po_id = $model->purchase_order_id; $this->redirect(array('/PurchaseOrder/preview', 'id' => $model->purchase_order_id)); } } //end of ifisset(). $this->render('create', array('model' => $model)); }