entering new data to int usnig web server

Hello ,
I want to be able to change the time the led is on using the arduino Ethernet
so if I will enter the Arduino server at 10.0.0.1
I will see a place to enter a number and this number will enter my Ontime
when the program start the
int LEDOnTime=500;

how do I do this?

I didn't write the code yet - just want to know how to add this part

Thanks ,

I have found this code
that make the led ON\OFF ,I have try to change it to work with numbers
so when I enter a number it will turn the led on for the new input
so I will write 600 it will turn on for 600mS

so what I need to change ?
to change the input to atoi?
where is the input save ?
didn't know where to find it

//zoomkat 1-10-11
//web LED code
//for use with IDE 1.0
//open serial monitor to see what the arduino receives
//use the \ slash to escape the " in the html 
//address will look like http://192.168.1.102:84/ when submited
//for use with W5100 based ethernet shields

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 10, 0, 0, 102 }; // ip in lan
byte gateway[] = { 10, 0, 0, 10 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(80); //server port

String readString; 

//////////////////////

void setup(){

  pinMode(4, OUTPUT); //pin selected to control
  //start Ethernet
  Ethernet.begin(mac, ip, gateway, subnet);
  server.begin();

  //enable serial data print 
  Serial.begin(9600); 
  Serial.println("servertest1"); // so I can keep track of what is loaded
}

void loop(){
  // Create a client connection
  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string 
          readString += c; 
          //Serial.print(c); //uncomment to see in serial monitor
        } 

        //if HTTP request has ended
        if (c == '\n') {

          ///////////////
          Serial.println(readString);

          //now output HTML data header

          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();

          client.println("<HTML>");
          client.println("<HEAD>");
          client.println("<TITLE>Arduino GET test page</TITLE>");
          client.println("</HEAD>");
          client.println("<BODY>");

          client.println("<H1>HTML form GET example</H1>");

          client.println("<FORM ACTION=\"http://10.0.0.102\" method=get >");

          client.println("New delay time is : <INPUT TYPE=TEXT NAME=\"TIME\" VALUE=\"\" SIZE=\"25\" MAXLENGTH=\"50\">
");

          client.println("<INPUT TYPE=SUBMIT NAME=\"submit\" VALUE=\"Change the time!\">");

          client.println("</FORM>");

          client.println("
");

          client.println("</BODY>");
          client.println("</HTML>");

          delay(1);
          //stopping client
          client.stop();

          /////////////////////
          if(readString.indexOf("on") >0)//checks for on
          {
            digitalWrite(4, HIGH);    // set pin 4 high
            Serial.println("Led On");
          }
          if(readString.indexOf("off") >0)//checks for off
          {
            digitalWrite(4, LOW);    // set pin 4 low
            Serial.println("Led Off");
          }
          //clearing string for next read
          readString="";

        }
      }
    }
  }
}
  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string 
          readString += c; 
          //Serial.print(c); //uncomment to see in serial monitor
        }

Do you know what this part of the code does? Do you have any idea how the browser communicates with the Arduino?

If the answer to either question is no, then you should heed that last comment.

It is all but impossible to parse a client request without knowing what the client is asking.

as I was saying at the start
this is the code I have found online - I didn't wrote it , I don't know how it works
all I have want is to not to write "on\off" to light up the led in pin4 , but to enter a number and save it as int and them work with it as I want.
for start to turn the led on for the time written .

so tell me which part I need to change ? which part I need to understand more

Thanks ,

this is the code I have found online - I didn't wrote it , I don't know how it works

You are going to get exactly nowhere until you do understand it.

all I have want is to not to write "on\off" to light up the led in pin4 , but to enter a number

Feel free.

and save it as int

How are you going to determine what part of the client request to convert to an int, if you have no idea what the client request looks like?

so tell me which part I need to change ?

I charge for that. $100 an hour.

which part I need to understand more

All the ones you don't understand now. Start with printing the client request.

I have did what you told me
and print the serial.print(c)

this is what I get when I enter the number "15"

GET / HTTP/1.1
GET / HTTP/1.1

GET /?TIME=15&submit=Change+the+time%21 HTTP/1.1
GET /?TIME=15&submit=Change+the+time%21 HTTP/1.1

now what?
I think I understand that he save the value in "TIME"? am i right?
but I don't see any where in the code where to manipulate it and "play" with this number

Thanks ,

PaulS:
I charge for that. $100 an hour.

That's actually quite cheap. I think PaulS should be charging more. :wink:

I think I understand that he save the value in "TIME"? am i right?

No. The text is stored in readString, which you (presumably) printed. Now, you need to parse the String. Using indexOf() to find "TIME", you can then find the start of the value. Using indexOf(), you can find the & that marks the end of the value. The substring between the = and the & is the value AS A STRING. The toInt() method (on the substring) will give the value as an int.