Advertisement
Guest User

Untitled

a guest
Jan 13th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.94 KB | None | 0 0
  1. $form = new Form;
  2. $form->action='?1';
  3. $form->getElementPrototype()->novalidate = "novalidate";
  4. $cont = $form->addContainer('first');
  5.  
  6. $cont->addText('name', 'Your name:')
  7.     ->setRequired('Enter your name');
  8.  
  9. $cont->addHidden('a', 1);
  10. $cont->addSubmit('submit', 'Send');
  11.  
  12.  
  13.  
  14.  
  15. $form2 = new Form;
  16. $form2->action='?2';
  17. $form2->getElementPrototype()->novalidate = "novalidate";
  18. $cont = $form2->addContainer('second');
  19.  
  20. $cont->addText('name', 'Your name 2:')
  21.     ->setRequired('Enter your name');
  22.  
  23. $cont->addHidden('b', 1);
  24. $cont->addSubmit('submit2', 'Send');
  25.  
  26.  
  27.  
  28. if ($form->isSuccess() && $_POST['first']['a']) {
  29.     echo '<h2>Form was submitted and successfully validated</h2>';
  30.     Dumper::dump($form->getValues(), [Dumper::COLLAPSE => FALSE]);
  31.    
  32. }
  33.  
  34.  
  35. if ($form2->isSuccess()  && $_POST['second']['b']) {
  36.     echo '<h2>Form2 was submitted and successfully validated</h2>';
  37.     Dumper::dump($form->getValues(), [Dumper::COLLAPSE => FALSE]);
  38.    
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement