Replace this logic with if ($type == '') type = 'all';