implementando o order by no form habtm, removi o echo.