You can
download the sketch from HERE, it works on both ESP8266 and
ESP32
The sketch as it is will first create a wifi access point named
"ESPconfig", you need to connect to this with the password "password"
and you will then be able to enter your wifi network details so it is
then able to connect to it (it uses the WifiManager library to do this
which is included in the above file). Once connected to your
network you should be able to view a similar web page to the image above
(you will need to find out what ip address it is using from your router
or by viewing the terminal window in the Arduino IDE).
If you look in the procedure "handleRoot", the lower part is where it
creates any control buttons and the top part is where it performs any
actions when the buttons are pressed. Any information you want to
update (e.g. sensor status) are put in the procedure "data" as this is
then automatically updated every few seconds (not the ideal way to do
this but I think the simplest).
You can then add your own code to the "loop" section to perform whatever
tasks you wish...