简体   繁体   中英

Submit Two forms in one controller

How can I make sure that, that second form elements go to the database cause when I check there the is no data but its been inputted by the user, if both forms are called from one controller

$form = new Form_Form1(); 
$this->view->form = $form;

$form2 = new Form_Form2();  
$this->view->form2 = $form2;


if ($this->getRequest()->isPost()) {
    $formData = $this->getRequest()->getPost();
    if ($form->isValid($formData)) {     

尝试这个:

if ($form->isValid($formData) && $form2->isValid($formData)) {...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM