When sent via the form the following is considered correct and it proceeds as normal giving me “This is valid zip code”.
However, if no value is set and the script sets the value of $_GET if fails. Even though when echoed it is exactly as it should be.
[php]if(!isset($_GET[‘zip’])){
$_GET['zip'] = '27858';
$_GET['distance'] = '999';
}
$zip = $_GET[‘zip’];
$distance = $_GET[‘distance’];
echo $zip;
//outputs 27858 when no value set via form
if(preg_match(’/^[0-9]{5}$/’, $zip)){
echo 'This is valid zip code';
else {
echo 'This is not a number';
}
[/php]