1988 Benz 300 E

I have a 1988 Benz 300 E runs fine but when u put it in gear it shuts off , starts right back up runs fine again until u put into gear.

Sounds like it idles just fine, running is definitely is another question. Off the top of my head, I am suspecting a transmission problem.

is it a sensor u think located where?