QuickForms Beginner problem
| From: | Fred | Date: | Tue, 16 Mar 2004 19:03:15 +0000 |
| Subject: | QuickForms Beginner problem | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-11328@lists.php.net to get a copy of this message | ||
While trying to learn a little bit about QuickForms, I used the
following from a tutorial example:
<?php
require_once "HTML/QuickForm.php";
$form = new HTML_QuickForm('frmTest', 'POST');
$form->addElement('header', 'MyHeader', 'Testing QuickForm');
$form->addElement('text', 'MyTextBox', 'What is your name?');
$form->addElement('reset', 'btnClear', 'Clear');
$form->addElement('submit', 'btnSubmit', 'Submit');
$form->addRule('MyTextBox', 'Your name is required',
'required');
if ($form->validate())
{
$form->process('process_data', false);
# If the form validates then freeze the data
$form->freeze();
}
$form->display();
function process_data ($values)
{
echo "<pre>";
var_dump($values);
echo "</pre>";
}
?>
When I try to use this, the form appears, but neither of the buttons
work. I looked at the html source produced and the reason is kind of
obvious: there is no action in the form. Actually, instead of a form
tag, there is a formarray tag in the html source with no attributes.
According to my web host, HTML_QuickForm v3.2.1 is installed. Anyone
know what the problem is here?
Fred