Re: How to pass/access form data with Quickform???
| From: | Jochen Schneider | Date: | Thu, 29 May 2003 20:27:35 +0000 |
| Subject: | Re: How to pass/access form data with Quickform??? | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-5686@lists.php.net to get a copy of this message | ||
Hi!
Many thx for your fast answer!
Perhaps I've expressed myself a little bit to complicated, so lets try it again...
The 'real doc' is being worked upon. There is some stuff in peardoc CVS already. If you do not want to checkout the docs from CVS and build them from DocBook XML yourself, you can check some sites that have more or less current builds, for example http://www.appelsiini.net/~tuupola/php/peardoc2/package.html.html#package.html.html-quickform
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: // example of creating a completely custom look for the form $form =& new HTML_QuickForm('tmp_form','POST','test2.php'); // clear all templates so we can give it a custom look $renderer =& $form->defaultRenderer(); //$renderer->clearAllTemplates(); // Grouped elements $form->addElement('header', '', 'Grouped Elements'); $name['last'] = &HTML_QuickForm::createElement('text', 'last'); $name['last']->setSize(30); $name['first'] = &HTML_QuickForm::createElement('text', 'first'); $name['first']->setSize(20); $form->addGroup($name, 'name', 'Name (last, first):', ', '); // Creates a group of buttons to be displayed at the bottom of the form $buttons[] = &HTML_QuickForm::createElement('submit', null, 'Submit'); $buttons[] = &HTML_QuickForm::createElement('reset', null, 'Reset'); $form->addGroup($buttons); // Adds validation rules for groups $form->addGroupRule('name', 'Please fill all fields', 'required'); // Tries to validate the form if ($form->validate()) {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.
// Form is validated, then processes the data
$form->freeze();
echo "\n<HR>\n";
}
$form->display();
Yes, my fault! Perhaps now, I was able to describe my problems a little bit precisly. Many thanx and greets JochenAnd how can I access the data on the second page? For example: Getting the name on teh second page: I do: Var_dump($name); I get an result, but like this array(2) { ["last"]=> string(4) "Schneider" ["first"]=> string(7) "Jochen" } I just want to get the value and not how long this string is!!!Well, if you don't know what var_dump() is, then you probably should read some tutorials on PHP before requesting tutorials on QuickForm. ;]