Time out! Some e36's use the three button remote, some use the two. What year is your car?
The "black box" is located behind the glove box, kind of a pain to get to.
Since you said you need to buy a replacement for your keyless entry, which keyless fob did you used to have? That will probably be a clue on which one you need to replace it with.
And yeah, I'd buy one off of e-bay rather than spend a fortune at the dealer (doubt autozone has a replacement for you).
<span style='color:green'>1994 325i </span>- - - 75,000 mi.
No mods - - - very happy as is!
<span style='color:green'>1995 525i </span>- - - 154,000 mi.
No squeaks or rattles... unreal!