Re: How to pass/access form data with Quickform???

From: Date: Fri, 30 May 2003 08:05:11 +0000
Subject: Re: How to pass/access form data with Quickform???
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-5703@lists.php.net to get a copy of this message
Hi! Jochen Schneider wrote:
I just want to create a 'normal' form, validating some fields and passing the data to another php-file. How can I do that? Right now I can instatiate a new Form and give the argument where to pass the data! Thats ok, but then validating doesnt work!
That's understandable: if you define validation rules on *one* page they will probably not appear on *other* page by magic. QuickForm is designed to have the form definition and validation in *one* script, that generally makes life easier.
You are completly right. Thats exactly what I want to do. I want to create the form, by submitting I want to validate and afterwards(!) the validated data should be given to the second page. Here are my code: ... // Tries to validate the form if ($form->validate()) {
    // Form is validated, then processes the data
    $form->freeze();
    echo "\n<HR>\n";
}
You can include your 'second page' after validating the form, like this: if ($form->validate()) { include 'page_that_does_the_processing.php'; exit; } If you *really* need to pass the data to another page (which I doubt), you can store the data in file/session/DB (as Thomas already told you) and redirect to that page: if ($form->validate()) { store_somewhere($form->getSubmitVaues()); header ('Location: page_that_does_the_processing.php'); exit; }

« previous php.pear.general (#5703) next »