I found the following 'function' for validating a ZIP code:
function validate_zipcode($zipcode) {
return preg_match('/^[0-9]{5}([- ]?[0-9]{4})?$/', $zipcode);
}
I've been trying to figure out how to use it in a form where $shipzip is the ZIP Code:
if (isset($_POST['submit'])) {
$shipzip = $_POST['shipzip'];
if($shipzip is invalid) { // Pseudo Code
echo "Sorry, Inaccurate ZIP Code";
}
}
Thanks for any help with so I can understand how similar 'function' calls can work.