There is a safety feature on vehicles that does not allow the transmission to be shifted into gear without the brake pedal being depressed. It is possible that this switch is worn or faulty. Most likely, you will just need to replace the switch. To be sure though, it would be best to bring your vehicle to a qualified technician that can test the component and properly diagnose the problem.
〉 Answered on Apr 4th, 2008 by Suzanne Grego, Technician at City of Philadelphia Fleet Management