multiple HTML_Quick FORM not validating and posting
| From: | Atif Khan | Date: | Mon, 20 Mar 2006 16:18:45 +0000 |
| Subject: | multiple HTML_Quick FORM not validating and posting | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23352@lists.php.net to get a copy of this message | ||
Here is the code
After submitting values form form1, I display form2, but form two does not
like validating form2, it goes back to form1.
<?php
// Load the QuickForm code
require "HTML/QuickForm.php";
$form1 = new HTML_QuickForm("form1", 'GET', null, null, null, true);
$form1->addElement("text","entered_text","Enter some text");
$form1->addRule("entered_text","You must enter text","required");
$form1->addElement("submit","submit","Submit");
if ($form1->validate()){
$form2 = new HTML_QuickForm("form2", 'GET', null, null, null, true);
$form2->addElement('text', 'name', 'Enter name');
$form2->addElement("submit",'submit2',"Submit2");
$form2->addRule('name', 'You must enter name','required');
$form2->display();
if ($form2->validate()){
header("Location: http://www.yahoo.com");
}
}else
$form1->display();
?>