| arnaud sellenet bodin 2006-03-20, 6:57 pm |
| The problem with your code is that once the first form is submitted =20
and validates, the second form displays.
Then when the second form is submitted, the first form is not =20
submitted anymore, so does not validate, so neither the second one.
You should have a look at HTML_QuickFrom_Controller it's built to =20
handle forms that spread on several pages.
Le 20 mars 06 =E0 17:18, Atif Khan a =E9crit :
> Here is the code
> After submitting values form form1, I display form2, but form two =20
> does not
> like validating form2, it goes back to form1.
>
>
>
> <?php
>
> // Load the QuickForm code
> require "HTML/QuickForm.php";
>
> $form1 =3D 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 =3D new HTML_QuickForm("form2", 'GET', null, null, null, =20
> 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();
> ?>
>
> --=20
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
|