HTML_QuickForms2
| From: | Matthew Morris | Date: | Mon, 20 Jul 2009 18:44:34 +0000 |
| Subject: | HTML_QuickForms2 | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-29943@lists.php.net to get a copy of this message | ||
Hello,
I am very new to PEAR but enjoying the ease of it all, I have been trying to
use the above package and having difficulties, I have added the code below
that I am trying to use;
<?php
// Include HTML_QuickForm
require_once 'HTML/QuickForm2.php';
// Instantiate our form, called 'Create'
$form = new HTML_QuickForm2('Create', 'post', basename(__FILE__));
// Our Default Form Options
$opts = array('size' => 20, 'maxlength' => 255);
// Add our form elements
$form->addElement('static', 'header', null,
'<h1>Register</h1>'
);
$form->addElement('text', 'first_name', 'First Name', $opts);
$form->addElement('text', 'last_name', 'Last Name', $opts);
$form->addElement('text', 'login', 'Login Name', $opts);
$form->addElement('password', 'password', 'Password', $opts);
$form->addElement('text', 'email', 'E-Mail', $opts);
$form->addElement('static', 'validemail', null,
'<strong>E-Mail address must be valid, and will only be'.
' used for account verification.</strong>'
);
$form->addElement('textarea', 'signature', 'Signature',
array('rows' => 10, 'cols' => 20));
$form->addElement('file', 'avatar', 'Avatar Image');
$form->addElement('static', 'reqs', null,
'<strong>Image <em>must</em> be no more than 64x64 pixels in
size.</strong>'
);
// Don't forget the Submit button!
$form->addElement('submit', 'register', "Register Now!");
$formsource = $form->toHtml();
?>
<!DOCTYPE html public "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Register</title>
<meta http-equiv="Content-type"
content="text/html; charset=iso-8859-1" />
<style type="text/css">
body {
font-family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
}
h1 {
font-size: 1.2em;
color: navy
}
</style>
</head>
<body>
<?php echo $formsource; ?>
</body>
</html>
When I go to the page to view the above it comes back with parse errors etc,
could you please advise what is wrong with the code so that I can get it to
work.
Thank you for your help
Matthew