P light not on when shift to P because car won't start

:
cx5
Hi all, recently I noticed that sometimes the P light won't light on when shifting the gear to P. Today the car didn't start. After a close check, I notice the P light is not on either. So I shift the gear to neutral and the car started. Can anyone please tell me what the problem is? I still can shift the gear to P and the light will be on. But not always. Thanks.
 
I don't have any experience replacing that part myself, but know someone who had it done on his 2010 Mazda 5.
Symptoms where the same: console would not show the park position and the car would start in Neutral or if jiggled enough with the shifter to get Park showing up on display.
Fix was to have the shift position sensor replaced on the front of the transmission.

Video I found about the repair itself:
 
Back