PHP code example of ride / lib-form

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

    

ride / lib-form example snippets




function createForm(Form $form) {
    // id of the form
    $form->setId('form-example');
    // action to catch submission of different forms on one page
    $form->setAction('submit-example');
    
    $form->addRow('name', 'string', array(
        'label' => 'Name',
        'description' => 'Enter your name',
        'filters' => array(
            'trim' => array(),
        ), 
        'validators' => array(
            '=> 'Extra',
        'description' => 'Extra row to show off some other options',
        'multiple' => true,
        'disabled' => false,
        'readonly' => false,
        'attributes' => array(
            'data-extra' => 'An extra attribute for the HTML element',
        ),
    ));
    
    return $form->build();
}