Using a input to control wifi

I found this thread that gave me the answers I seek..