public function updateamenityAction() { global $mySession; $db = new Db(); $amenityId = $this->getRequest()->getParam('amenityId'); $this->view->amenityId = $amenityId; $this->view->pageHeading = "Edit Amenity"; if ($this->getRequest()->isPost()) { $request = $this->getRequest(); $myform = new Form_Amenity($amenityId); if ($myform->isValid($request->getPost())) { $dataForm = $myform->getValues(); $myObj = new Amenity(); $Result = $myObj->saveAmenity($dataForm, $amenityId); if ($Result == 1) { $mySession->sucessMsg = "Amenity updated successfully."; $this->_redirect('property/amenity'); } else { $mySession->errorMsg = "This Amenity you entered is already exists."; $this->view->myform = $myform; $this->render('editamenity'); } } else { $this->view->myform = $myform; $this->render('editamenity'); } } else { $this->_redirect('property/editamenity/amenityId/' . $amenityId); } }