I don't know how you wired this.
Leaving your input pin floating (i.e. no connection whatsoever) is a recipe for disaster as you don't know the state of the pin (it will likely randomly fluctuate between HIGH and LOW). You must always have it pulled one way, so the switch can pull it the other way.
Easiest switch connection: one pin for input, internal pull up resistor activated, switch between the pin and GND. Reading is HIGH when the switch is open (due to the pull up resistor), LOW when the button is pressed (connecting the pin to GND - and you have a small current of <0.5 mA running through it).