PHP code example of jdz / form
1. Go to this page and download the library: Download jdz/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/ */
jdz / form example snippets
use JDZ\Form\Form;
use JDZ\Form\FormData;
$form = new Form('contact');
$fieldset = $form->makeFormFieldset('main');
// add fields / rows to the fieldset, each with its filters and rules
// bind submitted values and run the lifecycle
$form->init(new FormData($_POST));
if ($form->submit()) {
// $form->filter(); normalize
// $form->validate(); apply rules
if (!$form->getErrors()) {
// persist $form->getData()
}
}