This is functional but not all that user friendly... before checking if it is a number, I would remove any whitespace, parens (), dashes -, and periods .
In the last page I did this, I did it on the form with javascript before it was submitted... something like...
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function checkPhone(f) {
var tmp = f.phone.value;
tmp = tmp.replace(/[().\s-]/gi,'');
if (!isFinite(tmp) ||
tmp.length != 10)
{
alert("Please enter a valid 10 digit phone number");
return false;
}
f.phone.value = tmp;
}
//-->
</SCRIPT>
<form onSubmit="return checkPhone(this);">
Phone Number: <input type="text" name="phone" size="20" maxlength="20"><br>
<input type="submit">
</form>
hope this helps.