buttons in WEB server

Hello everybody. Have a problem with inserting buttons. The target is to print "surprise" to serial (debug ver) after the button is pressed but the problem is that whatever I do on the webpage "surprise" is being printed. Please don't blame the code very much : I'm quite a dummy in programing :slight_smile:

void loop()
{
  EthernetClient client = server.available();
  
 LcdPrintTime();
 
  if(client)
  {
    boolean CLISB=true;
    while(client.connected())
    {
     char c=client.read(); 
     Serial.print(c);
     HTTP_req += c;
     if (c=='\n' && CLISB)
     {
                    
     [b]    Serial.println(HTTP_req);
          Serial.println(HTTP_req.length());
          if (HTTP_req.indexOf('vlad')>0)
          {Serial.println("SUPRISE");}
         [/b]  

                    client.println(F("HTTP/1.1 200 OK"));
                    client.println(F("Content-Type: text/html"));
                    client.println(F("Connection: close"));
                    client.println();
                    // send web page
                    client.println(F("<!DOCTYPE html>"));
                    client.println(F("<html>"));
                    client.println(F("<head>"));
                    client.println(F("<title>Arduino Watering Time Calibration</title>"));
                    client.println(F("</head>"));
                    client.println(F("<body>"));
                    client.println(F("<h1>TIME CALIBRATION</h1>"));
                   
                                        
                    
                    client.println(F("<input type=\"submit\">"));
                    client.println(F("</form>"));



[b]                     client.println("<a href=\"/?vlad\" >ON</a>");  [/b]               
                
                
                    TimeUpdate(client);
                   
                    client.println(F("</body>"));
                    client.println(F("</html>"));
                    break;
                    

     }
     
     if (c=='\n')
     {CLISB=true;}
     else if (c != '\r')
     {CLISB=false;}
     
    }

delay(1);
client.stop();

 HTTP_req = "";    // finished with request, empty string
}
}

Take some time and learn HTML specifically about forms in HTML.

                    client.println(F("<body>"));
                    client.println(F("<h1>TIME CALIBRATION</h1>"));
                    client.println(F("<input type=\"submit\">"));
                    client.println(F("</form>"));
                    client.println("<a href=\"/?vlad\" >ON</a>");
                    TimeUpdate(client);
                    client.println(F("</body>"));

Your body is missing some stuff, like the start of the form.