if ($val->run()) ...
if ($val->run( array($my_validation_rule => $my_value_to_validate) )) ...
$val = Validation::factory(); $val->add('email')->add_rule('valid_email'); if ($val->run(array('email'=>$email))) { echo " '$email' is a valid email or is empty "; } else { echo " '$email' is NOT a valid email "; }
Hello, your posted codeJason Judge wrote on Thursday 10th of November 2011:The validation rules can be applied to POST data when a form is submitted. But is there a simple way to use the validation rules against non-POST data, for example to check whether a string contains a valid email address? -- JJ
$val = Validation::factory(); $val->add('email')->add_rule('valid_email'); if ($val->run(array('email'=>$email))) { echo " '$email' is a valid email or is empty "; } else { echo " '$email' is NOT a valid email "; }
$val->run(Input::get(NULL))
Harro Verton wrote on Sunday 13th of November 2011:Don't know which version you're looking at, but 1.1 returns the entire $_GET array when you use Input::get().
Harro Verton wrote on Monday 14th of November 2011:Please note that the official docs are for the official release, as of now that is 1.0.1. If you're using the develop branch code, you should look at http://fuelphp.com/dev-docs.
It looks like you're new here. If you want to get involved, click one of these buttons!