PHP code example of gsouf / uform
1. Go to this page and download the library: Download gsouf/uform library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gsouf / uform example snippets
use UForm\Builder;
$form =
Builder::init("action", "POST")
->columnGroup()
->column(3, 12)
->text("firstname", "Firstname")->ation')
->text("login", "Login")->ith the post data
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$formContext = $form->validate($form->getInputFromGlobals());
if ($formContext->isValid()) {
$filteredData = $formContext->getData();
// Do some logic with data
// ...
}
} else { // Or else we just generate a context with empty values
$formContext = $form->generateContext([]);
}
// We want to render some html for bootstrap 3
$formRenderer = new Bootstrap3Render();
$html = $formRenderer->render($formContext);
echo $html;