PHP code example of majorman / formbuilder

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

    

majorman / formbuilder example snippets


echo $form = new Form(
    'foo.php',
    'post',
    ['id' => 'fooID', 'class' => 'fooClass'],
    'multipart/form-data'
    );
		
/* Result : <form id="fooID" class="fooClass" method="post" novalidate="0" autocomplete="off" action="foo.php" formenctype="multipart/form-data"> */



echo $form->endForm();

//EXAMPLE TEXTAREA
echo $form->addElement(new TextArea)
          ->setValue('Lorem Ipsum dollar')
            ->addRule(['maxlength' => 25])
            ->setName('fooTextArea')
            ->addProperty(['style' => 'background:yellow']);

/* Result : <textarea  maxlength="25" name="fooTextArea" style="background:yellow">Lorem Ipsum dollar</textarea> */