phpHtmllib is a great tools to build web form. However, it would be cumbersome when your number of elements grows since you have to lay it out somehow either by manually add the elements to table object or write another method to automatically layout the elements. In my derived StandardForm class, I have two methods that deals with the element layout.
class myform extends StandardFormContent { ...snip function layout(&$table, &$section){ foreach ($section as $k => $v) { $row = html_tr(); $caption = html_td(); $felement = html_td(); if (isset($this->example[$k])) { $caption->add($this->element_description($k)); $felement->add($this->element_form($k)); $felement->add($this->element_example($k)); } else { $element = $this->element_form($k); if ($element->_attributes['type'] == 'hidden') { $caption->add(''); $felement->add($this->element_form($k)); } else { $caption->add($this->element_description($k)); $felement->add($this->element_form($k)); } } $row->add($caption); $row->add($felement); $table->add($row); } } function add_element_section(&$element, $section=null) { $element->set_stripslashes( $this->_stripslashes ); //in case the element needs it for js $element->set_form_name( $this->_form_name ); $name = $element->get_label_text(); $this->_elements[$name] = &$element; if ($section != null) { $this->_section[$section][$name] = $name; } //do we have a File form element? if (is_a($element, 'fefile')) { $this->_has_file_element = TRUE; $this->_file_elements[] = $name; } if ($element->_has_form_on_submit) { $this->_form_on_submit .= $element->form_tag_onsubmit(); } } }