The field $fieldName is required.

\n"; ++$errorCount; $retval = ""; } else //Only clean up the input if it isn't empty { $data = trim($data); $data = stripslashes($data); $pattern = "/\d{3}-\d{3}-\d{4}/"; if (preg_match($pattern, $data)) { $retval = $data; } else { echo "

The field $fieldName must be a telephone number in the form ###-###-####.

\n"; ++$errorCount; $retval = ""; } } return($retval); } echo validatePhoneNumber("", "TelephoneNumber"); ?>