Anirban Nath - 2014-12-16 05:43:47 -
In reply to message 1 from Rodolfo Bardin
HI rbardin,
//Example usage,
//Multiple POST or GET values(eg While submitting Form)
$request = Request::getInstance(); //initialize or call singleton class
$rules = array( 'METHOD' => 'GET',
'REQUIRED' => array('name','email') ,
'SANITIZE' => array('name' =>'STRING','email' => 'EMAIL'),
'VALIDATE' => array('name' =>'ALPHA', 'email' => 'EMAIL'),
); //RULES should be defined based on your requirements
#OUTPUT ::
echo '<pre>';
print_r($request->validate($_GET,$rules));
//---------Single value validate or sanitize or both-----------
$singleValue = 'Anything'; //$_POST['sumthing'];
//OUTPUT ::
print_r($request->validate($singleValue,array('REQUIRED' => true,'VALIDATE' =>'ALPHA', 'SANITIZE'=> 'STRING'),true));
echo '</pre>';