PHP Classes

File: example/index.php

Recommend this page to a friend!
  Classes of Muhammad Umer Farooq   PHP Validation   example/index.php   Download  
File: example/index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Validation
Validate request values according to given rules
Author: By
Last change:
Date: 5 years ago
Size: 440 bytes
 

Contents

Class file image Download
<?php

   
require __DIR__.'/vendor/autoload.php';
   
   
$rules = [
       
'username' => ['required' => true, ],
       
'email' => ['required' => true],
       
'password' => ['required' => true, ],
    ];
   
$validation = new Validation($_POST,$rules,'input');
    if(
$validation->fail()){
       
$errors = $validation->error()->get();

        foreach (
$errors as $error) {
            foreach (
$error as $value) {
                echo
$value."<br>";
            }
        }
    } else {
       
//TO-Do create the user
   
}