PHP code example of berlioz / form

1. Go to this page and download the library: Download berlioz/form 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/ */

    

berlioz / form example snippets


$form = new Form('my_form', null, ['method' => 'post']);

$form->add('my_control', Text::class, ['label' => 'My control']);

$form = new Form('my_form', null, ['method' => 'post']);
// ...

$form->handle($request);

if ($form->isSubmitted() && $form->isValid()) {
    // ...
}

$addressGroup = new Group(['type' => 'address']);
$addressGroup
    ->add('address', Text::class, ['label' => 'Address'])
    ->add(
        'address_next',
        Text::class,
        ['label' => 'Address (next)',
         '

// Create group
$addressGroup = new Group(['type' => 'address']);
$addressGroup
    ->add('address', Text::class, ['label' => 'Address'])
    ->add(
        'address_next',
        Text::class,
        ['label' => 'Address (next)',
         't::class
]);

// Add collection to form
$form->add('addresses', $collection);