public function savetopicAction() { global $mySession; $db = new Db(); $this->view->pageHeading = "Add New Topic"; if ($this->getRequest()->isPost()) { $request = $this->getRequest(); $myform = new Form_Topic(); if ($myform->isValid($request->getPost())) { $dataForm = $myform->getValues(); $myObj = new Forums(); $Result = $myObj->SaveTopic($dataForm); if ($Result == 1) { $mySession->errorMsg = "New topic added successfully."; $this->_redirect('forum/index'); } else { $mySession->errorMsg = "Topic name you entered is already exists."; $this->view->myform = $myform; $this->render('addtopic'); } } else { $this->view->myform = $myform; $this->render('addtopic'); } } else { $this->_redirect('forum/addtopic'); } }