public function updatetopicAction() { global $mySession; $db = new Db(); $topicId = $this->getRequest()->getParam('topicId'); $this->view->topicId = $topicId; $this->view->pageHeading = "Edit Topic"; if ($this->getRequest()->isPost()) { $request = $this->getRequest(); $myform = new Form_Topic($topicId); if ($myform->isValid($request->getPost())) { $dataForm = $myform->getValues(); $myObj = new Forums(); $Result = $myObj->UpdateTopic($dataForm, $topicId); if ($Result == 1) { $mySession->errorMsg = "Topic updated successfully."; $this->_redirect('forum/index'); } else { $mySession->errorMsg = "Topic name you entered is already exists."; $this->view->myform = $myform; $this->render('edittopic'); } } else { $this->view->myform = $myform; $this->render('edittopic'); } } else { $this->_redirect('forum/edittopic/topicId/' . $topicId); } }