-
Notifications
You must be signed in to change notification settings - Fork 5
Basic use
stevewest edited this page Mar 8, 2013
·
7 revisions
The first step is to build a Form
object and add Inputs
and/or Fieldsets
to it. After this you can use a Renderer
to create the html for the form.
<?php
use FuelPHP\Fieldset\Form;
use FuelPHP\Fieldset\Input;
use FuelPHP\Fieldset\Fieldset;
$form = new Form;
$form[] = new Input\Text('name');
$form[] = new Input\Submit('submit', array('value' => 'GO!'));
//This will repopulate the form with any submitted data
$form->repopulate();
The form can then be rendered like so:
<?php
use FuelPHP\Fieldset\Render;
$engine = new BasicRender();
$formHtml = $engine->render($form);