PHP code example of mitchellston / form_validation
1. Go to this page and download the library: Download mitchellston/form_validation 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/ */
mitchellston / form_validation example snippets
//Let's pretend the url is https://www.test.com?username=carl
on\Methods;
use PostGetRequestValidation\Types;
use PostGetRequestValidation\Validation;
$test = new Validation("username", Methods::GET, Types::TEXT,
[
Attributes::minLength => ["value" => 5, "errorMessage" => "A username needs to at least be 5 characters long!"]
]);
echo $test->getValue(); # carl
echo $test->getErrors(); # ["A username needs to at least be 5 characters long!"]
//Now you can send back the errors to your users