Beispiel #1
0
function validateForm(&$errors)
{
    global $username, $password, $rep_password;
    if (!validateRequiredField($username)) {
        $errors['username'][] = 'Username required.';
    } else {
        if (!validateLength($username, 4)) {
            $errors['username'][] = 'Username must be 4 characters long.';
        }
    }
    if (!validateRequiredField($password)) {
        $errors['password'][] = 'Password required.';
    } else {
        if (!validateLength($password, 6)) {
            $errors['password'][] = 'Password must be 6 characters long.';
        }
    }
    if (!validateRequiredField($rep_password)) {
        $errors['rep_password'][] = 'Repeated password required.';
    } else {
        if (!validateLength($rep_password, 6)) {
            $errors['rep_password'][] = 'Repeated password must be 6 characters long.';
        }
    }
    return !empty($errors);
}
Beispiel #2
0
function validateForm(&$errors)
{
    global $numbers;
    if (!validateRequiredField($numbers)) {
        $errors['numbers'][] = 'Enter first number';
    }
    return !empty($errors);
}
Beispiel #3
0
function validateForm(&$errors)
{
    global $firstNum, $secondNum, $operation;
    if (!validateRequiredField($firstNum)) {
        $errors['firstNum'][] = 'Enter first number';
    }
    if (!validateRequiredField($secondNum)) {
        $errors['secondNum'][] = 'Enter second number';
    }
    return !empty($errors);
}