I cant get these two pieces of my validation to work…
if I have an IP of 192.168.1.1 — it fails… it only passes if I have 192.168.111.100 — a full IP ….. it needs to accept number like 10.1.1.1 etc…
[CODE]#
# IP address
#
$field = $ipaddress;
$field_name = “<b>IP Address</b>”;
if( (!$field)
|| strlen($field) < 8 || strlen($field) > 15
|| !preg_match(“/[0-9]{3}+[.]{1}+[0-9]{3}+[.]{1}+[0-9]{3}+[.]{1}+[0-9]{3}/”, $field, $matches )
)
{
$error_string .= $field_name . ” cannot be empty and can only contain numbers 0-9 and periods (ex. 192.168.101.102).<br />”;
}
this one just always fails…
[CODE]#
# check phone
#
$field = $Phone;
$field_name = “<b>Phone Number</b>”;
if( (!$field)
|| strlen($field) == 12 || strlen($field) > 12
|| !preg_match(“/[0-9]{3}+[-]{1}+[0-9]{3}+[-]{1}+[0-9]{4}/”, $field, $matches )
)
{
$error_string .= $field_name . ” must be in 10 digit format (ex. 811-555-1212).<br />”;
}
can anyone help me out..