Car starts but dashboard lights go out but when you put in it drive they come back on

Car starts - you need to give it gas to keep running but the dash board lights go out - sometimes they flicker on with the speedometer and other needles in the dash jumping
then if you put it in gear - everything comes on and stays on while driving - as soon as you stop and put it in park the car shuts off
Any ideas what is wrong? I have had the alternator replaced and the battery charged.
then if you put it in gear - everything comes on and stays on while driving - as soon as you stop and put it in park the car shuts off
Any ideas what is wrong? I have had the alternator replaced and the battery charged.
0