Serial.print() statements would help identify the problem. Is the switch being read correctly?
The other problem is I can access the web page on my laptop but not on my phone pr any other laptop. The ES is stacked on to the UNO and the uno is connected to my laptop via ethernet cable and laptop is connect to a wireless network.
How are you accessing the Arduino from the PC?
How is the PC configured, as far as internet sharing?
Why is the Arduino not connected to the router?
How is the router configured, as far as port forwarding?