Re: A simple example of HTML/Form.php usage?
| From: | (Stig Sæther Bakken) | Date: | Mon, 13 Aug 2001 09:52:47 +0000 |
| Subject: | Re: A simple example of HTML/Form.php usage? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-269@lists.php.net to get a copy of this message | ||
["Alan T. Miller" <amiller@hollywood101.com>]
> I was trying to work with the Form class in PEAR and was hoping someonw
> could provide the simplest example of its use to get started. I keep getting
> an error in just trying to instantiate a form object to work with.
>
> Any help would be most appreciated.
>
> What I tried....
> require_once 'PEAR.php';
> require_once 'HTML/Form.php';
> $form = new HTML_Form;
>
> The error I received:
> Warning: Missing argument 1 for html_form() in
> c:\winnt\system32\php4\pear\HTML\Form.php on line 61
>
> Line 61 =
> function HTML_Form($action, $method = 'GET', $name = '', $target =
> '') {
>
>
> The question is how do I intially call this???
Example from pearweb/public_html/account-request.php:
$form =& new HTML_Form($PHP_SELF, "POST");
$form->addText("handle", "Username", null, 12);
$form->addText("name", "Real Name", null, $width);
$form->addPassword("password", "Password", null, 10);
$form->addText("email", "Email Address", null, $width);
$form->addCheckbox("showemail", "Show Email Address?", null);
$form->addText("homepage", "Homepage", null, $width);
$form->addTextarea("purpose", "Purpose of your PEAR account",
null, $width, 3);
$form->addTextarea("moreinfo",
"More relevant information about you (optional)",
null, $width, 3);
$form->addSubmit("submit", "Submit Request");
$form->display();
if ($jumpto) {
print "<SCRIPT LANGUAGE=\"JavaScript\">\n<!--\n";
print "document.forms[0].$jumpto.focus();\n";
print "\n// -->\n</SCRIPT>\n";
}
- Stig
--
Stig Sæther Bakken <ssb@alltheweb.com>
Fast Search & Transfer ASA, Trondheim, Norway