Usual problem is shift stays in park and unable to shift out to other positions but yours is the reverse. Either symptoms are most probably due to the shift lock control system.
The red circle in picture indicates the shift lock lock override whereby if you insert the car key into it and push at the release lever within, you can manually release the shift lock. Try this and see if you are able to shift into R and P.
Something could have gone bad or, loosened or foreign materials could have fallen there and get wedged between the lock to prevent it from releasing.
You would need to remove the console to check.
Image (Click to make bigger)
Friday, November 24th, 2017 AT 2:06 AM