You have to multiplex the outputs.
1) Basically set all outputs high.
2) Check inputs. If no inputs high, there is nothing to do as no switches are made.
3) If ANY input is high, then start multiplexing.
4) Multiplexing - This involves setting all outputs low. The setting output 1 high, and then checking to see which of the inputs are set. Then set output 1 back low again.
5) Repeat 4) for each of your outputs.
Best to have it so you perform each output set per cycle (or once per a number of cycles if applying some input switch "debouce"). This "debounce" is where the output to be held high for several cycles and input has to be seen as high for several cycles to be confirmed. This will help counter any possible noise on the switch to prevent spurious readings.
The animation in the link I gave you explains this quite well.
Programming today is the race between software engineers building bigger and better idiot proof programs, and the universe producing bigger and better idiots.
So far, the universe is winning...