PHP code example of scratchwizard1 / form-generator
1. Go to this page and download the library: Download scratchwizard1/form-generator 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/ */
use FormGenerator\Form;
$result = Form::getDataFrom("contact-form", [
'name' => 'string;; // associative array of sanitized values
} else {
$error = $result->getError(); // returns one error at a time
}
use FormGenerator\Form;
$result = Form::getDataFrom("", [
'name' => 'string;t->getData(); // associative array of sanitized values
} else {
$error = $result->getError(); // returns one error at a time
}
use FormGenerator\Form;
$result = Form::getDataFrom("contact-form");
$data = $result->getData(); // all submitted data, no validation applied
[
'message' => "Validation error for key 'name': The value has length 2 and is below the allowed minimum.",
'code' => 422,
'id' => 'vE084',
'file' => '/var/www/html/index.php',
'line' => 42
]