At first you are DOUBLE posting.
Don't do that.
And for the question.
Maybe you have too play around an bit with frames.
print "<a href=frames.php?op=click&cid=2&bid=$bid ><img src=$imageurl ></a>";
Where frames.php is an page with an one pixel frame in wich the first url is done.
and the big frame the second url.
Maybe i'm explaining it wrong but you must see yourself.
If you REALLY can't get it post again and i give you an better example.