It seems you just need to change:
if(isset($_POST['quantite'][$i]))
to:
if(isset($_POST['quantite'][$i]) && $_POST['quantite'][$i] > 0)
You can also use for example array_filter()
to loop only over the keys that have an amount set:
if(isset($_POST['ajouter']))
{
$has_amounts = array_filter($_POST['quantite']);
foreach (array_keys($has_amounts) as $key)
{
$nomProd = $_POST['nomProd'][$key];
// etc.