Ok colpa mia per l'errore, ma ci si poteva anche arrivare eh

Sostituisci $val con $values