Re: QuickForm question
| From: | Stowe Spivey | Date: | Fri, 19 Nov 2004 16:07:07 +0000 |
| Subject: | Re: QuickForm question | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15686@lists.php.net to get a copy of this message | ||
--- Jay Drake <jdrake@planhouse.com> wrote:
>
> > 1) RTFM
> > 2) Look at the examples included with the package (installed
> under the
> > docs/
> > directory of your PEAR installation).
>
> Thanks much for pointing me in the right direction. (Not being
> facetious!)
> #2 was just what I needed.
>
> Jason
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I was in your shoes not too long ago - and still am to some degree.
Yuu are right about setting defaults. Here's what I do - hope it
helps:
- query table based on passed ID
- create new QuickForm
- set form defaults
- create fields
- set vaildation rules
- then use something like the code below:
if ($form->validate()) {
$form->process('process_data', false);
header("Location: http://localhost/whatever.php");
exit;
}
function process_data ($values) {
$resUPDATE = $db->prepare('UPDATE complaint SET <fields> WHERE
complaintID=?');
$db->execute($resUPDATE, array($values['fieldName'],...));
if (DB::isError($resUPDATE)) {
die($resUPDATE->getMessage());
}
}
$form->display();
__________________________________
Do you Yahoo!?
The all-new My Yahoo! - Get yours free!
http://my.yahoo.com