PHP code example of ucscode / uss-form

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

    

ucscode / uss-form example snippets


use Ucscode\UssForm\Form;
use Ucscode\UssForm\Field;

// Instantiate the form

$form = new Form();

// Get the default internal Collection instance (or create and add new ones)

$collection = $form->getCollection(Form::DEFAULT_COLLECTION);

// Create any desired Field;

$regularField = new Field();
$emailField = new Field(Field::NODE_INPUT, Field::TYPE_EMAIL);
$passwordField = new Field(Field::NODE_INPUT, Field::TYPE_PASSWORD);
$textareaField = new Field(Field::NODE_TEXTAREA);
$selectField = new Field(Field::NODE_SELECT);

// Add the created fields into the collection

$collection->addField("username", $regularField);
$collection->addField("email", $emailField);
$collection->addField("password", $passwordField);
$collection->addField("textarea", $textareaField);
$collection->addField("select", $selectField);

// Return and print the HTML Output

echo $form->export();