PHP code example of hakimch / form

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

    

hakimch / form example snippets


$form = HakimCh\Form\Form::init();
$form->setup(
    $datas, // Submited datas
    $token, // If you want add csrf token (d
                'class' => 'formClass', // adding a class
                'enctype' => 'multipart/form-data' // If you want use it for upload some files
           ])->open();

// you can add fields here

echo $form->close(); // Closing form

// Create label(name, for, span class="->label('firstName', true);
// A normal text field with a name
echo $form->text('firstName');

// Add an Advanced text field with options
echo $form->addAttr([
        'id' => 'secondName',
        'value' => 'Chmimo',
        'class' => '

echo $form->select('record', [1, 2, 3]);

echo $form->addAttr('value',1)->radio('testRadio', 'Radio 1');
echo $form->addAttr('value',2)->radio('testRadio', 'Radio 2');

echo $form->addAttr('value',1)->checkbox('testCheckbox[]', 'Checkbox 1');
echo $form->addAttr('value',2)->checkbox('testCheckbox[]', 'Checkbox 2');

// Accept one arg (value)
echo $form->addAttr('class', 'btn btn-success')->submit('Send my Form');