Using HTML_QuickForm To Manage Web Forms, Part 1 - FORM Elements
(Page 4 of 13 )
Now, I have to add different <FORM> elements to my "Registration" Web form.
<?php
// snip
$obj_registration_form->addElement('header', '', 'Registration');
$obj_registration_form->addElement('html', '<tr><td colspan="2"> </td></tr>');
$obj_registration_form->addElement('header', '', 'Artist Information');
$obj_registration_form->addElement('html', '<tr><td colspan="2"> </td></tr>');
// snip
?>
All HTML_QuickForm elements are broadly divided into two categories: standard HTML <FORM> elements and custom elements.
First, I have added two custom HTML_QuickForm elements using the addElement() method - the first custom type is the "header" element that allows us to display "header" text - text with a larger font size - in the Web form. Next, I included some raw HTML code using the "html" custom element - nothing much to talk about.
A little warning before I proceed - the official documentation does not recommend the use of this "html" element as it can soon lead to spaghetti-style HTML code in your PHP script. Instead, they recommend the use of templates to control the layout. You'll learn more about using templates in the second part of this tutorial.
Next: Adding Standard HMTL FORM Elements >>
More Design Usability Articles
More By Harish Kamath