PHP code example of lanin / 1000forms

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

    

lanin / 1000forms example snippets



 
// Initialise object
$form = new \Lanin\Forms\Form();
 
// Set name of our form
$form->setName('login_form');
 
// Add "Name" textfield
$form->addElement('textfield', 'login', array('label' => 'Name'));
// Add "Password" element
$form->addElement('password', 'password', array('label' => 'Password'));
 
// And add wubmit button
$form->addElement('submit', 'login', array('value' => 'Login'));
 
// Check if form was submitted and values are valid
if ($form->isValid()) {
    // Get values and print them
    print_r($form->getFormState());
}
 
// Print our form
print $form;