Help with OR in IF statement ( code included )
Hello:
I found some individual code that works perfectly for what I need. The following code checks the data on zip/postal codes ( US and Canadian ) for compliance. My problem is that I think I need something like an OR statement in my code. If preg does not match either us format or canadian format then $errZip. Can anyone help me on this please.
// Zip must be 5 digits
if(preg_match("/^\d{5}$/", $_POST["zip"]) === 0)
$errZip = '<class="errText">Zip must be 5 digits';
// Postal must be 6 alphsnumeric with either space or - seperator
if(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"]) === 0)
$errZip = '<class="errText">Postal Code must be character and numeric';
Thanks