Welcome Guest, Not a member yet? Register   Sign In
Postal Code Validation
#1

I wanted to make a function for the validation of postal code to customize an error message if possible. I wonder if you have an idea.
Here's an idea of my function:
// checks postal code format L4X-1S9 
$regex = '/[a-z][0-9][a-z][- ]?[0-9][a-z][0-9]$/i'; 
if( preg_match($regex, $zip) ) 
  echo "Valid postal code"; 


I USED THE FOLLOWING CODE

$crud->set_rules('pass_no','Code postal','required|regex_match[/regex/]
but not working ....

Some useful links :
http://devtipsforu.b...ostal-code.html
http://arjunphp.com/...es-codeigniter/

If you have a idea
Thanks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB