A menu with some buttons

so for example,

i declare the following

int buttonPins[] ={31,32,33,34,35,36};
int buttonState[] ={0,0,0,0,0,0};
[/code/

31,32,33 are the pins I use on the mega.  I use an array so that I don't have to do so many if statements
the example below is when i go into a menu, I display the options on the screen and then wait for a response, if they don't respond in 10 seconds I break out of the code and go back to the previous or main loop.

[code]
long mil = millis();
 long timer = 0;
lcd.clear();
  lcd.print("Admin Mode:  1-Update");
  lcd.setCursor(0,1);
  lcd.print("2-FreeVend 3-Off");
int thisPin;
  // the array elements are numbered from 0 to (pinCount - 1).
  // use a for loop to initialize each pin as an output:
   int buttonpressed = 0;
     while(buttonpressed < 1){
       timer = millis();
       for (int thisPin = 0; thisPin < drinkPinCount; thisPin++)  {
            buttonState[thisPin] = digitalRead(buttonPins[thisPin]);
            buttonpressed += buttonState[thisPin];           
       }
       if(timer - mil > 10000) {buttonpressed = 1;}     
     }
     if(timer - mil < 10000){
      if (buttonState[0] == HIGH) {     
           lcd.print("Admin Mode: Update");
           lcd.setCursor(0,1);
           lcd.print(RFIDnum);
           delay(500);
        Serial.println("Admin mode 0");
        admintimeout = 0; 
        while(admintimeout <1){AddtoCard();}
      }
      if (buttonState[1] == HIGH) {     
           lcd.print("Admin Mode:");
           lcd.setCursor(0,1);
           lcd.print("Free Drink On");
           for (int setcost = 0; setcost < drinkPinCount; setcost++)  {
            drinkCost[setcost] = 0;
           }  
           FreeDrink();
           delay(500);
           Serial.println("Admin mode 1");
        
      }
      if (buttonState[2] == HIGH) {     
           lcd.print("Admin Mode:");
           lcd.setCursor(0,1);
           lcd.print("Free Drink Off");
           soundSad();
           soundSad();
           soundSad();
           delay(1500);
           ReadPrices();
           
        Serial.println("Admin mode 2");
     }
    
   
    }

[/code]