Displaying a FormBuilder Form

From Web Developer Network Wiki
Jump to: navigation, search

Now create your php page to view the form on /Library/WebServer/Documents/directory/index.php:

<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/directory/config.inc.php');

$do =& DB_DataObject::factory('tablename');
$fb =& DB_DataObject_FormBuilder::create($do);
$form =& $fb->getForm();
if ($form->validate()) {
    $form->process(array(&$fb,'processForm'),false);
}
echo $form->toHtml();
?>

This will render a page with a form for the table you created. To format the form differently, edit the /Library/WebServer/Documents/directory/DataObjects/tablename.php file.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox