jeudi 4 août 2016

I want to Sum user input and compare with if statement

I am trying to see if $cvirtuals + $csports is less than $csuperdice I have 3 inputs a,b, and c. I wrote this code:

$cvirtuals = clean($_POST['cvirtuals']);
$ccolour = clean($_POST['ccolour']);
$csports = clean($_POST['csports']);

if (Math.abs($cvirtuals + $csports) < $csuperdice) {
$errmsg_arr[] = "Account is not balanced";
$errflag = true;
        }
else {
        die("Query failed");
    }

if($errflag) {
    $_SESSION['ERRMSG_ARR'] = $errmsg_arr;
    session_write_close();
    header("location: cashiers.php");
    exit();
}

When i run the above code, it returns query failed, even if the cvirtuals+csport is less than csuperdice. Please someone help me solve this problem.

Aucun commentaire:

Enregistrer un commentaire