Skip to content

Instantly share code, notes, and snippets.

@Octagon-simon
Created July 29, 2022 03:34
Show Gist options
  • Select an option

  • Save Octagon-simon/5f58e122fd6adffef040be792a2426fd to your computer and use it in GitHub Desktop.

Select an option

Save Octagon-simon/5f58e122fd6adffef040be792a2426fd to your computer and use it in GitHub Desktop.
<?php
//custom rules
$customRules = array(
"UNAME" => ['/simon/', "You must enter simon"],
"PASS" => ['/12345/', "You must enter 12345"]
);
//build the rules
$DemoForm->moreCustomRules($customRules);
//redefine validation rules
$valRules = array(
"username" => array(
["R", "Your username is required"],
["UNAME"]
),
"email" => array(
["R", "Your Email is required"],
["EMAIL", "Your Email is invalid"]
),
"age" => array(
["R", "Your Age is required"],
["DIGITS", "Your Age must be in digits"]
),
"password" => array(
["R", "Your Password is required"],
["PASS"]
)
);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment