How to validate decimal variables with php?

exception or error:

I have a product in my sql table. From this product, the minimum order quantity is 19.2

If i want to add 19, the program allows it.

$product_id = intval($_POST['product_id']);
    $quantity = $_POST['quantity'];
    $color = intval($_POST['szin']);
    $MinimumOrder = $_POST['MinimumOrder'];

    if($quantity%$MinimumOrder == 0 )
    {
        $cart->add($product_id, $quantity, array
            ( 
                "price" => $price,
                "color" => $color 
            )
        );

        echo 'A termék sikeresen hozzá lett adva a kosárhoz.';
    }
    else
    {
        echo 'Ebből a termékből csak egész raklap rendelhető. Egy raklapon  ' . $MinimumOrder . ' ' . $product['mertekegyseg_nev'] .' található.';
    }
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *