PHP code example of joshcanhelp / php-form-builder
1. Go to this page and download the library: Download joshcanhelp/php-form-builder 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/ */
joshcanhelp / php-form-builder example snippets
$new_form = new PhpFormBuilder();
$new_form = new PhpFormBuilder('http://submit-here.com');
// Add a new form action
$new_form->set_att('action', 'http://submit-here.com');
// Change the submit method
$new_form->set_att('method', 'get');
// Change the enctype
$new_form->set_att('enctype', 'multipart/form-data');
// Can be set to 'html' or 'xhtml'
$new_form->set_att('markup', 'xhtml');
// Classes are added as an array
$new_form->set_att('class', array());
// Add an id to the form
$new_form->set_att('id', 'xhtml');
// Adds the HTML5 "novalidate" attribute
$new_form->set_att('novalidate', true);
// Adds a WordPress nonce field using the string being passed
$new_form->set_att('add_nonce', 'build_a_nonce_using_this');
// Adds a blank, hidden text field for spam control
$new_form->set_att('add_honeypot', true);
// Wraps the inputs with a form element
$new_form->set_att('form_element', true);
// If no submit type is added, add one automatically
$new_form->set_att('form_element', true);
$new_form->add_input('I am a little field', array(), 'little_field')
$new_form->build_form();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.