You need to increment the index variable when the button becomes
pressed, not when it is
pressed. Look at the state change detection example in the IDE to see how to do it.
Also consider using
to activate the internal pullup resistor and remove the external pull down resistor if you have one, which I suspect you don't, and wire the button to pull the pin low when pressed. This will ensure that the input is always at a known voltage and not floating between 0V and 5V. Note that when you do this you will need to invert the logic of the test to see whether the button is pressed.