For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > February 2006 > Re: [PEAR] HTML_QuickForm passing varialbles to another page after validation









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] HTML_QuickForm passing varialbles to another page after validation
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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com