you've a html error in that. it should be:
echo "<a href=\"add_to_cart.php?imagekey=".$idnum."\" target=\"_blank\">Add to cart</a>";
but you could use java script for the same (and more customisable) effect:
the HTML would be:
<a href="#" onClick="window.open('hyperlink.php', 'Image', 'toolbar=0 scrollbars=0 resizable=1 width=650 height=470'); return false;">Link</a>
which will open the link in a window 650 x 470, with no scrollbars and no toolbar etc etc.