When a car is in drive and stalls out, it usually means there is an absence of fuel or spark, a faulty fuel pump or alternator, or some other mechanical failure within the engine itself. There are a number of methods available for testing the problem behind the stalling.
If the accelerator pedal is pressed to the floor and the engine still stalls or dies out completely, most commonly this is a result of lack of fuel. In this case, it is necessary to either tow the vehicle to a gas station for a fill-up or to call for roadside assistance to have emergency fuel delivered.
If there is black smoke rising from the rear tailpipe of the car, this could indicate either a lack of fuel or lack of a spark from the car's spark plug.
If the car stalls out but starts right back up immediately, the problem might be electrical. In this case, it is recommended to consult a mechanic or dealer to analyze the exact nature of the electrical issue.
If the car stalls out and then restarts right back up after giving it a few minutes without power, this is usually indicative of a bad fuel pump, and the part might need replacing.