First of all, you shouldn't fill up your petrol car with diesel or vice versa. This is because the fuels differ in their properties and the corresponding engines are constructed differently to suit each fuel.
Before going in detail into the consequences of usage of a fuel in a non-compatible engine, one must first understand the differences between each fuel and the mechanism involved in generating energy from each fuel.
With respect to petrol, energy is generated as a result of the ignition of petrol using a spark, which is usually achieved using a spark plug. Petrol engine cars contain the pre-filled mixture of air and petrol which is injected into the combustion chamber and the combustion is initiated using the spark plug.
Whereas, the ignition of diesel occurs as a result of the compression of air into a small volume, which results in the generation of heat. Combustion is initiated on spraying diesel. An important point of difference that one may be able to clearly notice between a petrol engine and diesel engine is the absence of the requirement of a spark plug in a diesel engine to initiate compression.
Now that you are acquainted with the difference in the properties of each fuel and the mechanism involved to achieve combustion, let us get into the topic at hand, namely, the consequences of using diesel in a petrol engine. For the purpose of providing additional information, I shall also be mentioning briefly the consequences of the use of petrol in a diesel engine.
Though the usage of non-compatible fuels in a particular engine is generally not a wise idea, please note that the use of diesel in a car with petrol engine is relatively less harmful when compared to the use of petrol in a diesel engine. This is because petrol is a highly volatile fuel that has a low ignition temperature. As mentioned earlier, diesel engines are composed of pre-filled compressed mixture of air and diesel.
Once petrol is introduced to such highly compressed air, there would be a violent ignition that can result in detonation. This can affect the lubrication of the engine thereby resulting in the damage to the engine cylinder, the piston and other components. The petrol may also corrode the fuel delivery system. The car might run for a short time, but such use can cause heavy damage to the engine. Furthermore, fixing the diesel engine will involve the replacement of the pumps and the injectors, which is an expensive affair. And if the damage extends to the fuel delivery system, the price is just going to go up.
On the other hand, if diesel is introduced into a car with a petrol engine, there will not be any ignition and the car wouldn't start as diesel is not volatile as petrol. The car will sputter and then stall. Repairing a diesel engine to which petrol was introduced to, would involve draining and flushing the fuel system, refueling the same with Petrol and resetting the entire system.
In the event you feel that your car has been filled with the wrong fuel, it is extremely important that you should not attempt to start the engine. Move the car to a safe spot and get the same checked by a mechanic. By doing so, your car engine may be fixed with a mere flushing of the fuel.