I assume it's in Park now. There is an interlock solenoid in the linkage, accessible from the shift boot. You may be able to manually disengage this lock.
Check on the E38 forum.
OTOH, if the car got any water inside that flooded the floor, consider it a total, and ask your insurance company to total it. If you try to resurrect this car, it will plague you with electrical problems all of your days.
Ed in San Jose '97 540i 6 speed aspensilber over aubergine leather. Build date 3/97. Golden Gate Chapter BMW CCA Nr 62319.