97 mazda 626 4cylinder transmission problem

my sons 626 has had intermittent trans issue over the last few weeks. Now it won’t go into gear but intermittently he can get it to work. My husband noticed that the gear shifter lifted up and actually came off. He saw loose wires. Could this cause the transmission issue my son has experienced?

Sure it could. The shift interlock which keeps the shift lever from coming out of “P” until the brake pedal is pressed sounds like the problem here. Since the shifter is not secured down, the wiring to the switch could be stressed and causing an intermittant connection.