This isn't tested but see if it works:
PHP Code:
<?php
$seq[0] = preg_match("/^\d{5}$/", $_POST["zip"]);
$seq[1] = preg_match("/^([A-CEGHJ-NPR-TV-Z]){1}[0-9]{1}[A-CEGHJ-NPR-TV-Z]{1}[ -][0-9]{1}[A-CEGHJ-NPR-TV-Z]{1}[0-9]{1}$/i",$_POST["zip"]);
$set[0] = "<class=\"errText\">, Zip, 5 digits";
$set[1] = "<class=\"errText\">, Postal Code, character and numeric";
$errZip = '%s %s must be %s';
if(($seq[0] === 0) || ($seq[1] === 0))
{
if($seq[0] === 0)
{
$errZip[0] = sprintf($errZip,$set[0]);
}
if($seq[1] === 0)
{
$errZip[1] = sprintf($errZip,$set[1]);
}
$errZip = join('<br />',$errZip);
}
?>
Bookmarks