Some years ago i used a switch for using 1 keyboard and 1 mouse on 2 PCS.
THe switch was analogic with 2 keyboards and 2 mouses as input and 1 keyboard and 1 mouse as output, you just had to swith from PC A to PC B or vice-versa. It worked perfectly, and it was not expensive.

But video... if you want a switch to use 1 monitor with 2 PCs, be very carefull, i bought one (analogic) and the image was a shxx... to keep the good a image quality, you need a digital switch... and they are much more expensive.