There are a few possibilities and a bit of further investigation will be needed to see what is going on with your gearshift.
A common problem can be with a small black plastic link on the gearshift module on top of the gearbox. In the first instance check this to make sure it is attached correctly, it tends to wear & come off one end and jams the gearshift up preventing correct shifting.
if this is ok then the cables from the gear lever to the shift module need to be checked next to ensure they are in good order & free to move.
If this is ok then the shift module will need to be removed from the gearbox to check the operation of this - this requires the engine & gearbox to be lowered down to unbolt & lift out the shift module from the gearbox.
finally if this is ok then it could be an internal fault inside the gearbox.
Best regards, Paul