A valve has a body, an outer shell and a bottom board. The outer shell contains a membrane and internal and external sliding bases with abutting stubs pressing the membrane. Channels are defined in the body and the sliding bases. The bottom board fits inside a rear of the body and has multiple apertures rotatably aligning the channels in the body to change “5-way, 2-position” or “3-way, 2-position” operation modes. Moreover, an electromagnetic valve with a shaft is installed inside the valve and cooperates with the movement of the sliding bases to selectively open or close the channels.