Multiple choice inputs

I'm currently writing a code for a liquid dispenser which involves 4 solenoid valves and 4 pushbuttons. Im using MOSFETs to handle the heavy load components and a single ultrasonic sensor. The intention is to write a piece of code that assigns a state of one button to a specific valve (prior to dispensing) and based on what state it is in, it would either allow the valve to pour or stay shut. Would anyone help me out with this?

Post the code you have so far, using code tags (</> button on the toolbar).

Explain exactly what difficulties/questions you're having with the code.