我有一个控制器动作
public function pagedetailAction(){
$id = $this->_getParam('id',0);
$detail = new Application_Model_Page();
$this->view->detail = $detail->findArr($id);
//CALLING FORM WITH OTHER CONTENTS
$form = new Application_Form_Request();
$this->view->form = $form;
}
要处理表格,我有这个功能
public function submitrequestAction(){
if ($this->getRequest()->isPost()) {
$formData = $this->getRequest()->getPost();
if ($form->isValid($formData)) {
$newsadd = new Application_Model_Request($formData);
$newsadd->set_ID(null);
$newsadd->save();
$this->_helper->flashMessenger->addMessage(array('success'=>'Message Sent'));
$this->_redirect('/index/frontmsg');
} else {
$form->populate($formData);
}
}
}
当我单击提交时,我收到错误
Notice: Undefined variable: form in E:\xampp\htdocs\sandbox1\application\controllers\IndexController.php on line 84
Fatal error: Call to a member function isValid() on a non-object in E:\xampp\htdocs\sandbox1\application\controllers\IndexController.php on line 84
请帮助我,以便我可以通过此表单将值发布到数据库。谢谢