Sounds like you need a KVM switch...here is one example...the kind you get depends on the hardware you have (whether you have USB mouse/keyboard or PS2, etc)
http://www.newegg.com/Product/Product.aspx?Item=N82E16817107702
http://www.newegg.com/Product/Product.aspx?Item=N82E16817107702