public function employeeAction() { $employee = new Application_Model_DbTable_Employee(); $form = new Application_Form_Employee(); $form->setAction('index/employee'); $this->view->form = $form; if ($this->getRequest()->isPost()) { $formData = $this->getRequest()->getPost(); $form->isValid($formData); if ($form->isValid($formData) && $form->save->isChecked()) { $id = (int) $form->getValue('id'); $name = $form->getValue('name'); $address = $form->getValue('address'); $salary = $form->getValue('salary'); $errorMessage = $employee->updateEmployee($id, $name, $address, $salary); if ($errorMessage != "") { echo $errorMessage; } else { $this->_helper->redirector('employee', 'index', null, array('id' => $id)); } } else { if ($form->cut->isChecked()) { $id = (int) $form->getValue('id'); $employee->cutEmployee($id); $this->_helper->redirector('employee', 'index', null, array('id' => $id)); } } } else { $id = $this->_getParam('id', 0); $e = $employee->getEmployee($id); $form->populate($e); } }