if(isset($_GET['submit'])) {
if(preg_match("/^\(([2-9][0-9]{2})\)[2-9][0-9]{2}-[0-9]{4}$/i",
$_GET['phone']) != 1) {
echo "The phone field was invalid
";
}
} else {
/* Code to process form here */
}
?>
Elementary form validation