I had a similar problem whereby my car would go into M mode, but 'D' would be displayed and i couldn't change gear and traced it to a faulty part behind the steering wheel.
I don't know what its called but its what the wires from the steering wheel connect to in order to prevent the wires from rotating as the steering wheel does.
To check; Frstly disconnect the battery and wait several minutes to prevent the airbag from discharging, then remove the two torx screws that hold the airbag on, you will then be able to see the connector that plugs into the device.
Remove all the cowling from around the steering wheel (i think there are 3 screws hold this on from memory) and once removed you'll see the reverse side of this part with another electrical connector. Test continuity with a multimeter, and if the current doesn't transfer, then it will need replacing.
if your car doesn't even go into 'm' mode, then i would suggest to check the switch in the gear selector.
Best of luck,
Phil