Problem using project through USB port and wall outlet

So i have a little machine i made with a water pump, arduino uno, a button and some leds. When i push the button, a red led should light up and the pump start pumping water. then after 20 seconds, it should stop and a green led turn on. It works perfectly fine when i plug the arduino into my computer via usb cable, but when i plug the usb cable into a charger that plugs into a wall outlet, the arduino thinks it pushed the button and it starts pumping water immediately. I would use the external power jack but i dont have a cable for it. Could some one please help me? this is annoying me a lot. Thanks in advance.

Have you got a pullup or pulldown resistor on the input pin keeping it in a known state at all times or is it floating at a maybe HIGH/maybe LOW state causing the input to change state without the button being pressed ?

Please follow the advice on posting a programming question given in Read this before posting a programming question

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless