text From Client Browser To i2c LCD ESP 8266

Im starting a project for using a web browser to send simple text string to an esp i2c lcd and googled it to see if i can save any time as i kept getting errors on compiling
I found this post

it looks good, it does what i need, however I don't wish to use any sd card for a simple project, i want to store what the sd card file would normally hold in a variable called text_display

I also want this to work as an access point and have the ability to be accessed through a routers AP, so by commenting out a line it can hide its stand alone AP and use the routers AP (iv done this before couple years ago)

so to sum up however I connect to the esp as a client i would be greeted with a simple form to input 2 lines of text and that value stored into a var for outputting to an i2c lcd, Im stuck on compiling, here is just 1 example that failed...

// (c) J~NET
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x38, 16, 2);

// #define OLED_RESET 4

const char* ssid = "RouterAP";
const char* password = "SECRETPASS";

ESP8266WebServer server(80);

const int output1 = 14;
const int output2 = 12;
const int output3 = 13;
const int output4 = 15;

boolean device1 = false;
boolean device2 = false;
boolean device3 = false;
boolean device4 = false;

void handleRoot() {
//digitalWrite(led, 1);
//server.send(200, "text/plain", "hello from esp8266!");
//digitalWrite(led, 0);

String cmd;
cmd += "\r\n";
cmd += "\r\n";
//cmd += "ESP8266 Webserver

"ESP8266 Web Server Control"

";
cmd += "";
cmd += "<form action="/submit">Text To Display:
<input type="text" name="text_display">

"; cmd += "";

if(device1){
cmd +=("
Device1 : ON");
}
else{
cmd +=("
Device1 : OFF");
}

if(device2){
cmd +=("
Device2 : ON");
}
else{
cmd +=("
Device2 : OFF");
}

if(device3){
cmd +=("
Device3 : ON");
}
else{
cmd +=("
Device3 : OFF");
}

if(device4){
cmd +=("
Device4 : ON");
}
else{
cmd +=("
Device4 : OFF");
}

cmd += "\r\n";
server.send(200, "text/html", cmd);
}

void handleNotFound(){
//digitalWrite(led, 1);
String message = "File Not Found\n\n";
message += "URI: ";
message += server.uri();
message += "\nMethod: ";
message += (server.method() == HTTP_GET)?"GET":"POST";
message += "\nArguments: ";
message += server.args();
message += "\n";
for (uint8_t i=0; i<server.args(); i++){
message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
}
server.send(404, "text/plain", message);
//digitalWrite(led, 0);
}

void setup(void){
lcd.begin();
lcd.backlight();
lcd.print("Please Wait...");

pinMode(output1, OUTPUT);
pinMode(output2, OUTPUT);
pinMode(output3, OUTPUT);
pinMode(output4, OUTPUT);

digitalWrite(output1, LOW);
digitalWrite(output2, LOW);
digitalWrite(output3, LOW);
digitalWrite(output4, LOW);

Serial.begin(115200);
WiFi.mode(WIFI_STA); // comment out this line to use a router as an AP
WiFi.begin(ssid, password);
Serial.println("");

// by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
//display.begin(SSD1306_SWITCHCAPVCC, 0x3D); // initialize with the I2C addr 0x3D (for the 128x64)

delay(2000);

// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");

}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());

if (MDNS.begin("esp8266")) {
Serial.println("MDNS responder started");
}

server.on("/", handleRoot);

server.on("/submit", handle Submit);

if (server.args() > 0 ) {
for ( uint8_t i = 0; i < server.args(); i++ ) {
if (server.argName(i) == "text_display") {
// do something here with value from server.arg(i);
// output text to serial console & lcd
Serial.println(text_display);
lcd.print("text_display");

}
}
}

server.onNotFound(handleNotFound);
server.begin();
Serial.println("HTTP server started");
}

void loop(void){
server.handleClient();
}

please ignore the outputs as that is for the previous project i mentioned from years ago that i plan to use at a later date and did not want to strip out just yet, any ideas as to a good way to do this any help would be appreciated?

it looks good, it does what i need, however I don't wish to use any sd card for a simple project, i want to store what the sd card file would normally hold in a variable called text_display

In the project you linked to, the SD card is used to hold the page that the server serves up. If your page is small enough, and static enough, you don't need to store it in a file on an SD card.

here is just 1 example that failed...

You did not tell us what the compiler didn't like, so it is unlikely that you'll get help.

Sorry, il try and recompile...

Arduino: 1.8.2 (Windows 7), Board: "NodeMCU 0.9 (ESP-12 Module), 80 MHz, 115200, 4M (3M SPIFFS)"

C:\Users\Jay\Documents\Arduino\temp\temp.ino: In function 'void setup()':

temp:138: error: 'handle' was not declared in this scope

server.on("/submit", handle Submit);

^

temp:145: error: 'text_display' was not declared in this scope

Serial.println(text_display);

^

Multiple libraries were found for "ESP8266WiFi.h"
Used: C:\Users\Jay\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\ESP8266WiFi
Multiple libraries were found for "ESP8266WebServer.h"
Used: C:\Users\Jay\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WebServer
Not used: C:\Program Files (x86)\Arduino\libraries\ESP8266WebServer
Multiple libraries were found for "ESP8266mDNS.h"
Used: C:\Users\Jay\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266mDNS
Not used: C:\Program Files (x86)\Arduino\libraries\ESP8266mDNS
Multiple libraries were found for "LiquidCrystal_I2C.h"
Used: C:\Users\Jay\Documents\Arduino\libraries\LiquidCrystal_I2C
Not used: C:\Users\Jay\Documents\Arduino\libraries\LiquidCrystal_I2C_Auto_Address
exit status 1
'handle' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Also tried with handleSubmit
Arduino: 1.8.2 (Windows 7), Board: "NodeMCU 0.9 (ESP-12 Module), 80 MHz, 115200, 4M (3M SPIFFS)"

C:\Users\Jay\Documents\Arduino\temp\temp.ino: In function 'void setup()':

temp:138: error: 'handleSubmit' was not declared in this scope

server.on("/submit", handleSubmit);

^

temp:145: error: 'text_display' was not declared in this scope

Serial.println(text_display);

^

Multiple libraries were found for "ESP8266WiFi.h"
Used: C:\Users\Jay\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\ESP8266WiFi
Multiple libraries were found for "ESP8266WebServer.h"
Used: C:\Users\Jay\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WebServer
Not used: C:\Program Files (x86)\Arduino\libraries\ESP8266WebServer
Multiple libraries were found for "ESP8266mDNS.h"
Used: C:\Users\Jay\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266mDNS
Not used: C:\Program Files (x86)\Arduino\libraries\ESP8266mDNS
Multiple libraries were found for "LiquidCrystal_I2C.h"
Used: C:\Users\Jay\Documents\Arduino\libraries\LiquidCrystal_I2C
Not used: C:\Users\Jay\Documents\Arduino\libraries\LiquidCrystal_I2C_Auto_Address
exit status 1
'handleSubmit' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Take a look at the "Sending data to the ESP using HTTP POST" example on the following page:
https://tttapa.github.io/ESP8266/Chap10 - Simple Web Server.html

It shows how you can use an HTML form to send text data to the ESP, and how to do something useful with that data once it arrives. In this case, it just prints out the username on an HTML page, but you could easily adapt the code to show it on a display instead.

If you want to use it in AP mode, just use WiFi.softAP(ssid, password);. Note that there is a problem with mDNS when using AP_STA mode. It should be fixed in version 2.4.0 (there's a release candidate available, but I haven't tried it yet.)

I haven't found any good arguments for using SD cards with an ESP8266: for most purposes, the SPIFFS is a much better choice, and most modern boards have up to 3MB of storage, so it should be more than enough for some HTML/CSS/JS files, and even some icons or small images.

Pieter

No i got it working since but then lost the code over time as it was so long ago so i had a reply and checked it out again, and it worked but was acting glitchy as sometimes it would work and sometimes not, so on the actual esp if theres a way to extract the source code (ino text) let me know if not write it how it should be and il test it out?

i wana just see the best way to do this without sd card at all if pos as others have already done simular with sd card.