Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ESP8266WebServer.h>
- ESP8266WebServer server(80);
- const char* ssid = "UserName";
- const char* password = "12345678";
- String HtmlOpen = "<html><body>", HtmlIsi, HtmlClose = "</body></html>";
- void setup() {
- // put your setup code here, to run once:
- WiFi.softAP(ssid, password);
- HtmlIsi += "<div align='center'>";
- HtmlIsi += "<form action='/respon' method='post'>";
- HtmlIsi += "<input type='text' name='text'></br>";
- HtmlIsi += "<input type='submit' name='submit' value='Simpan'>";
- HtmlIsi += "</form>";
- HtmlIsi += "</div>";
- server.on("/", handleRoot);
- server.on("/respon", respon);
- server.begin();
- }
- void loop() {
- // put your main code here, to run repeatedly:
- server.handleClient();
- }
- void respon(){
- String string = server.arg("text");
- String htmlRes;
- htmlRes += HtmlOpen;
- htmlRes += string;
- htmlRes += HtmlClose;
- server.send(200, "text/html", htmlRes);
- }
- void handleRoot(){response();}
- void response(){
- String htmlRes;
- htmlRes += HtmlOpen;
- htmlRes += HtmlIsi;
- htmlRes += HtmlClose;
- server.send(200, "text/html", htmlRes);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement