PHP code example of edtsz / f3-form-validator

1. Go to this page and download the library: Download edtsz/f3-form-validator 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/ */

    

edtsz / f3-form-validator example snippets


$validator = new \Validator();
$validator->set_db( $f3->get('db.instance') ); // just if will use "is_unique"
$validator->set_rules(
	'username', 'Username',
	'   'd_email|is_unique[users.email]');

if ( $validator->run() === TRUE )
{
	// success
}
else
{
	print_r( $validator->error_array() );
}