Skip to content

twizdev/simple-php-input-validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Simple PHP Input Validation Class

This is a simple PHP class with the most common input validations.

VALIDATIONS
  • alphaNumeric - [A-Z] and [0-9]
  • alphaSpace - [A-Z] plus [SPACE]
  • alpha - [A-Z]
  • any - Any character
  • numeric, integer, float, email, ip, url, subDomain, domain

Usage

$validations = array(  
   [KEY] => array(
          [VALIDATION],
          [false/true],   # Is the field required, default is true
          [CUSTOM ERROR], # Your Custom error
  ),
);

Example

require "class.SimpleValidate.php";

$validations = array(
  "name"   => array( "alphaSpace" ),
  "phone"  => array( "integer", false ,"Phone number is invalid" ),
);

$result = SimpleValidate::validate( $_POST, $validations );
if( $result===false )
{
  $errors = SimpleValidate::getErrors();
}

About

This is a simple PHP class with the most common input validations

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy