It sounds like you are missing pull up or pull down resistors on your inputs. If you leave your inputs floating you will get unreliable results.
http://en.wikipedia.org/wiki/Pull-up_resistor <== read this for more info
If your input is normally off you'd use a pull down resistor and if normally on you'd use a pull up resistor. This is a simplified way of thinking about it but it makes it easy to know what to expect when reading the input.
When you look at the little schematic it show an open switch and a pull up resistor. This means that when they switch is open Vin will be going thru the buffer to Vout. Vout = Vin here. When the switch is close Vin will go thru the pull up resistor to thru the switch and to ground. The input of the logic gate would have 0 volts and would be directly connected to ground. Thus Vout = Ground.