1. Go to this page and download the library: Download form-manager/form-manager 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/ */
form-manager / form-manager example snippets
use FormManager\Factory as F;
//Create an input type="text" element
$name = F::text();
//Create the input with a label
$name = F::text('Please, introduce your name');
//Or with extra attributes
$name = F::text('Please, introduce your name', ['class' => 'name-field']);
//Add or remove attributes
$name->setAttribute('title', 'This is the name input');
$name->removeAttribute('class');
$name->setAttributes([
'
$email = F::email();
$email->setValue('invalid-email');
//Validate the value
if ($email->isValid()) {
return true;
}
//Get errors
$error = $email->getError();
//Print the first error message
echo $error;
//Iterate through all messages
foreach ($error as $err) {
echo $err->getMessage();
}
//You can also customize/translate the error messages
$email->setErrorMessages([
'email' => 'The email is not valid',
'
$name = F::text('What is your name?', ['name' => 'name']);
echo $name;