PHP code example of bancer / form-builder
1. Go to this page and download the library: Download bancer/form-builder 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/ */
bancer / form-builder example snippets
php
use Bancer\FormBuilder\FormBuilder;
...
$FormBuilder = new FormBuilder($this->Form); // where $this->Form is an instance of FormHelper
$FormBuilder->newForm($user)
->method('post')
->url(['controller' => 'users', 'action' => 'edit'])
->encoding('UTF-8')
->id('edit-user')
->classes('narrow-form');
echo $FormBuilder->newControl('User.email')
->label(__('Email'))
->readOnly()
->size(50)
->attribute('data-validated', 1)
->attribute('oninvalid', 'alert('Invalid email')');
echo $FormBuilder->newControl('User.password')
->label(__('Password'))
->type('password')
->size(30)
->minLength(8)
->maxLength(30)
->