Hi!
I'm a php newbee, trying to validate a phone number from a form. The following code is in the checknr.php file.
// check phone for validity
if (($PHONE_NO) || ($phone_no)) {
$phone_no = trim($phone_no);
if ($PHONE_NO)
$phone_no = trim($PHONE_NO);
if (!ereg("[0-9])", $phone_no)) {
print_error("your nr is not valid. Example of a valid phone nr. 091016750"
}
}
I don't know what to type in the "(!ereg("[0-9])" part of the code. The phone number can only be of a numeric value (0123456789)or like this (0910-1235478).
I'm a php newbee, trying to validate a phone number from a form. The following code is in the checknr.php file.
// check phone for validity
if (($PHONE_NO) || ($phone_no)) {
$phone_no = trim($phone_no);
if ($PHONE_NO)
$phone_no = trim($PHONE_NO);
if (!ereg("[0-9])", $phone_no)) {
print_error("your nr is not valid. Example of a valid phone nr. 091016750"
}
}
I don't know what to type in the "(!ereg("[0-9])" part of the code. The phone number can only be of a numeric value (0123456789)or like this (0910-1235478).