Re: [PHP] Validating postal codes

2002-11-15 Thread Marek Kilimajer
Either you may remove spaces: $form["authpstcode"]=str_replace(' ','',$form["authpstcode"]) and then compare or change your expresion to '(^\s*[a-z]\s*[0-9]\s*[a-z]\s*[0-9]\s*[a-z]\s*[0-9]\s*$)' The first is better as you may put it into database column that is just char(6) DonPro wrote: Hi,

Re: [PHP] Validating postal codes

2002-11-15 Thread Marco Tabini
This might work: if(!eregi('(^[a-z][0-9][a-z] ?[0-9][a-z][0-9]$)',$form["authpstcode"])) { $errors[] = 'You must input a valid Canadian postal code (A9A9A9) postal code if he/she resides in Canada'; $continue = false; } Marco -- php|architect - The magazine for PHP Profession

Re: [PHP] Validating postal codes

2002-11-15 Thread Michael Hazelden
From: DonPro [mailto:donpro@;lclcan.com] Sent: 15 November 2002 14:45 To: php list Subject: [PHP] Validating postal codes Hi, I'm trying to validate a Canadian postal code. I've already written a function; code as follows: if(!eregi('(^[a-z][0-9][a-z][0-9][a-z][0-9]$)',$f

[PHP] Validating postal codes

2002-11-15 Thread DonPro
Hi, I'm trying to validate a Canadian postal code. I've already written a function; code as follows: if(!eregi('(^[a-z][0-9][a-z][0-9][a-z][0-9]$)',$form["authpstcode"])) { $errors[] = 'You must input a valid Canadian postal code (A9A9A9) postal code if he/she resides in Canada'; $continue