====== OOhForms ====== [[http://www.sanisoft.com/phplib/manual/oohforms.php|Manual]] //OOhForms are part of the PHPlib-Mini-Framework// (Examples from KUSKUS) New form: require($_PHPLIB["libdir"]."oohforms.inc"); $fo = new form; // create a form object for form ===== Dropdown-Boxes ===== $fo->add_element(array("type"=>"select", "name"=>"f_person_gender", "valid_regex"=>"^[a-z]*$", "valid_e"=>"", "options"=>array(array("label"=>"K. Anrede","value"=>"0"), array("label"=>"Herr","value"=>"1"), array("label"=>"Frau","value"=>"2") ), "size"=>1, "value"=>$f_person_gender)); ===== Submit ===== $fo->add_element(array("type"=>"submit", "name"=>"submit", "value"=>"Abschicken")); ===== Checkbox ===== // which kind of calculation? reset($picture_calculate_type); unset($t); foreach($picture_calculate_type AS $key => $val){ if (is_array($calculation_type)){ if (in_array($key, $calculation_type)) $t[] = $key; } else { if (($calculation_type & $key) == $key) $t[]= $key; } } $fo->add_element(array("type"=>"checkbox", "name"=>"calculation_type", "value"=>$t, "multiple"=>1)); ===== Hidden ===== $fo->add_element(array("type"=>"hidden", "name"=>"selfcall", "value"=>"yes")); ===== Radio ===== name val extrahtml (will be displayed with leading space) ===== Textarea ===== rows cols wrap extrahtml (will be displayed with leading space) ===== Text ===== $fo->add_element(array("type"=>"text", "name"=>"f_person_title", "valid_regex"=>"^[a-z]*$", "valid_e"=>"Bitte nur Buchstaben beim Titel des Ansprechpartners
", "size"=>12, "maxlength"=>60, "icase"=>1, "value"=>$f_person_title));
===== Display form ===== // start // OOf mainform... $fo->start("", "GET", $PHP_SELF, "", "msgform"); // Start displaying form // display element: $fo->show_element("submit"); // Show submit // display multiple elements: $i=1; reset($picture_calculate_type); foreach($picture_calculate_type AS $key => $val){ if ($i++ % 2 == 1) echo ""; else echo ""; $fo->show_element("calculation_type", $key); echo " ".$val."\n"; } // finish: $fo->finish(); // Finish form {{tag>php phpForms oohforms Forms phplib}}