I think you need to pass on the querystring parameters from the page...
lines 251-253 should be:
<th><a href="categorie.php?sort=titolo&<?php echo($queryString_WADAannuncio); ?>">annuncio</a></th>
<th><a href="categorie.php?sort=prezzo&<?php echo($queryString_WADAannuncio); ?>">prezzo</a></th>
<th><a href="categorie.php?sort=marca&<?php echo($queryString_WADAannuncio); ?>">marca</a></th>