Wemos D1 ESP8266 IP address problem and data not showing online

Hi guys, i recently bought a Wemos D1 ESP8266 for a project of mine, i made the code you see on the bottom of the post, so basically i attached a dht11 sensor to the wemos D1, my goal is posting the data that the sensor constantly read into the IP address (so if i go on internet and type the IP address, humidity and tempereture data are showed in that page) but i have two problems in the code:

-the first one is the IP address, it is not static, depending by the wifi i connect the wemos, the IP changes, and i need the IP address to be static so i can change it whenever i want by the IDE and the IP i write into the IDE will be always that IP for the wemos D1.

-my secondary problem is that i can't read datas onto the IP via internet anyway, even with the IP being dynamic, i made a variable called "i" for humidity and "l" for temperature, so when the sensor reads the data, it writes data under form of l and i in the string you see at the beginning of the code as the string of the page, but it doesn't, it only write l and i when i go and check.

another think is that i can read datas and the connection, for example the IP address, into the serial monitor, so the sensor works, and gives to me every second the data i want.
Please help me out finding my mistackes into the code, i think that i put the ip to be dynamic by calling it "randomSeed" but to be honest i dont know how to put it static if my thoughts are right.

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <dht11.h>
dht11 DHT;
#define DHT11_PIN 4

int i = DHT.humidity;
int l = DHT.temperature;

String HeaderPage = "";
String FooterPage = "";
String rootPageBody = "<h2>i , l</h2>"; //here is where datas are showed
String rootWebPage;

const char *wifi_ssid = "WIFI NAME"; //name of the wifi 
const char *wifi_password = "WIFI PASSWORD"; //password of the wifi

ESP8266WebServer server(80);
WiFiClient espClient;

void setup() {
  Serial.begin(115200);
  Serial.println();

  setup_wifi();
  composeWebPage();
  startWebServer();
}

void loop() {
  server.handleClient();

  int chk;
  Serial.print("DHT11, \t");
  chk = DHT.read(DHT11_PIN);    // READ DATA
  switch (chk) {
    case DHTLIB_OK:
      Serial.print("OK,\t");
      break;
    case DHTLIB_ERROR_CHECKSUM:
      Serial.print("Checksum Error,\t");
      break;
    case DHTLIB_ERROR_TIMEOUT:
      Serial.print("Timeout Error,\t");
      break;
    default:
      Serial.print("Unknown Error,\t");
      break;
  }

  Serial.print(DHT.humidity, 1);
  Serial.print(",\t");
  Serial.println(DHT.temperature, 1);

  delay(1000);
}

void setup_wifi() {

  delay(10);
  Serial.print("Connecting... ");
  Serial.println(wifi_ssid);
  WiFi.begin(wifi_ssid, wifi_password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  randomSeed(micros());

  Serial.println("");
  Serial.print("WiFi connect at IP address: ");
  Serial.println(WiFi.localIP());
}

void handleRoot() {
  server.send(200, "text/html", rootWebPage);
}

void composeWebPage() {
  rootWebPage = HeaderPage;
  rootWebPage += rootPageBody;
  rootWebPage += FooterPage;
}

void startWebServer() {
  server.on("/", handleRoot);
  server.begin();
  Serial.println("SERVER BEGIN!!");
}

i want by the IDE and the IP i write into the IDE

To me, that doesn't make sense. The IP address of your PC changes all the time. Yet, you don't have trouble using google, and having it route messages back to your PC.

What the Wemos gets is a local IP address in your private LAN. The router that issues that address is the one that needs a fixed IP address, and needs to know how to route messages to the Wemos.

String rootPageBody = "<h2>i , l</h2>"; //here is where datas are showed

In the string, i and l are text, not the names of variables. You need to substitute values for those pieces of text before sending that String to the client.

amazing, this helps me a lot to understand how it works, but how do i substitute values for those pieces of text before sending that String to the client? How do i do that? Anyway, i need the IP to be static because of another step of the project that requires the static IP

wait, do you mean simply putting for example 27°C instead of "i"? Because i need "i" to change every time depending on the tempereturebasically i need to print instead of "i", the value i read on "i"

PaulS:
To me, that doesn't make sense. The IP address of your PC changes all the time. Yet, you don't have trouble using google, and having it route messages back to your PC.

What the Wemos gets is a local IP address in your private LAN. The router that issues that address is the one that needs a fixed IP address, and needs to know how to route messages to the Wemos.

String rootPageBody = "<h2>i , l</h2>"; //here is where datas are showed

In the string, i and l are text, not the names of variables. You need to substitute values for those pieces of text before sending that String to the client.

FYI

This is his school project.

Be sure to read sending gps data to google maps into a website. IMMEDIATE HELP - #7 by TheFDR99 - Project Guidance - Arduino Forum

That was a fiasco!

.