You can use the Form class into the controller or into the model with load_library, as following example:
Example
$this->load_library("Form","form_obj");
$this->form_obj->init_form("ajax.php");
$this->form_obj->open_table("Your form table");
$this->form_obj->add_hidden("variable", "value");
$this->form_obj->add_item("text", "input_name", "name", "description", "value", "required");
$this->form_obj->add_button();
$this->form_obj->close_table();
$this->draw( $ajax = true );
$this->form_obj->init_form("ajax.php");
$this->form_obj->open_table("Your form table");
$this->form_obj->add_hidden("variable", "value");
$this->form_obj->add_item("text", "input_name", "name", "description", "value", "required");
$this->form_obj->add_button();
$this->form_obj->close_table();
$this->draw( $ajax = true );
