Everybody:

This problem solved. It is not PHP's fault, It is mine. When I fixed some problems that I thought where non intrusive in this problem, everything started working as a charm.

Here is the finished function, it is part of a class called xValidate.

function integer(&$msg, $prompt, $value, $min, $max, $name) {
        $number = intval($value);
        
        if ($value == "") {
                $msg[$prompt] = "You have to write a number in this field.";
        } elseif (!is_numeric($value)) {
                $msg[$prompt] = "The contents of this field should be a number.";
        } elseif ($value != $number) {
                $msg[$prompt] = "This number should be an integer.";
        } else {
                xValidate::number($msg, $prompt, $number, $min, $max, $name);
        }
}

and just for the curious here is xValidate::number...

function number(&$msg, $prompt, $number, $min, $max, $name) {
if (!empty($min) and ($number < $min)) {
$msg[$prompt] = "This value should be a number greater than or equal to $min.";
} elseif (!empty($max) and ($number > $max)) {
$msg[$prompt] = "This value should be a number less than or equal to $max.";
}
}


Thanks for your interest,


Cesar.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to