anche cosi funge
print "onClick=\"window.open('file.php?id={$dati['id']}')\"";