when i try to filter all these parameters php only enters in the first if conditions, ignoring all others conditions.
if($t_red<0){ $t_red=0; } else if($
It's not clear what you're trying to do, but I think that you would want to remove the else before the third if statement and add an else before the sixth if statement.
else
if