E mettilo anche fra i tag php (<? e ?> altrimenti non funziona)

<a target="_blank" href="pag_prest.php?pres=<? echo $idy; ?>">