| Justin Patrin 2006-02-27, 7:00 pm |
| On 2/27/06, akhan <wequar98@gmail.com> wrote:
>
> Hello I am trying to Pass content of the form to another page
> after validating. I cannot seem to pass the values to the page after
> validation.
>
>
> I am new to php, so I will apologize for my ignorance.
>
>
> <?php
> require_once("HTML/QuickForm.php");
>
> // Create new instance - Form $Form =3D new HTML_QuickForm("Form", "get")=
;
> $Form->addElement("Text", "Name", "Text1", array("size" =3D> "30"));
> $Form->addElement("Submit", "Button", "Go");
>
> $Form->addRule("Name", 'Please Enter', 'required');
> if ($Form->validate())
> {
> header("Location: someaddress/test.php");
> }
> $Form->display();
>
> ?>
>
You can't do that. This *will* redirect to test.php, but the POST vars
will, of course, not be sent to it. The web browser sends these vars,
not the PHP script. If you need to post to a second page like this you
either need to do a post within your script (say, with HTTP_Request)
or make the action of the form test.php (which means you can't do
validation unless you create the form there too) or make a page with a
form with JS to post to the new page after validation happens here
(not a good solution), or (best solution) combine the two scripts, put
the content of test.php in your code instead of the header() call (or
you can include it...).
--
Justin Patrin
|