Ethernet Shield radio button question

Hey!

I'm a student of 17 in my last year. For school I have to make this project. The project is a webserver on wich I can read the analog values of a temperature sensor wich refreshes every 2seconds. And also i need to control a led with a radio button. There I have a question. How can I check wich button they selected. I know that if you use a button i need to check

if(inString.indexOf("led2") > 0){
}

But on what do you check when you are dealing with a radio button?

Many thanks if you answer (:

#include <SPI.h>
#include <avr/pgmspace.h>
#include <Ethernet.h>



char buffer[85];

char string_1[] PROGMEM = "<html><head><meta name='viewport' content='user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0'/>";
char string_2[] PROGMEM ="<meta name='apple-mobile-web-app-capable' content='yes' />";
char string_3[] PROGMEM ="<meta name='apple-mobile-web-app-status-bar-style' content='black' />";
char string_4[] PROGMEM ="<style type='text/css'>.button {padding:5px;margin:5px;font-size:14px;	color: #000000;	}</style>";
char string_5[] PROGMEM ="<meta http-equiv='refresh' content = '2'/>";

char string_6[] PROGMEM ="</head><body bgcolor='#333333'><center>"; 
char string_7[] PROGMEM ="<form method=GET><table border=0 width=100%><tr><td align=center>";
char string_8[] PROGMEM ="<input type=radio name=led1 value='On'/> On 
";
char string_9[] PROGMEM ="<input type=radio name=led1 value='Off'> Off 
</td>";   
char string_10[] PROGMEM ="<td>Waarde temperatuur sensor =  <a href='http://www.google.be'>www.google.be</a> ";

char string_11[] PROGMEM ="</td>";    
char string_12[] PROGMEM ="</table></body></html>";

PGM_P string_table[] PROGMEM = 
{
    string_1,
    string_2,
    string_3,
    string_4,
    string_5,
    string_6,
    string_7,
    string_8,
    string_9,
    string_10,
    string_11,
    string_12
};


byte mac[] = {  0x90, 0xA2, 0xDA, 0x00, 0x6D, 0xA2};
byte ip[] = {172, 16, 4, 26};
byte gateway[] = { 172,16,4,254 };
byte subnet[] = { 255,255,255,0 };
pinMode(1,OUTPUT);

String inString = String(35);
EthernetServer server(80);


void setup()
{
  Serial.begin(9600);
  Ethernet.begin(mac, ip, gateway, subnet); 
  server.begin();
  Serial.println("Serial READY");
  Serial.println("Ethernet READY");
  Serial.println("Server READY");
}

void loop()
{
  
  EthernetClient client = server.available();
  
  
  if (client) {
    
    // an http request ends with a blank line
    boolean current_line_is_blank = true;
    while (client.connected()) {
      
      if (client.available()) {
      
        char c = client.read();
        // if we've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so we can send a reply
        if (inString.length() < 35) {
          inString.concat(c);
        
           }
           
          if (c == '\n' && current_line_is_blank) {
                       
            if(inString.indexOf("led1") >= 0){
            
                  digitalWrite(1,HIGH);
                  delay(100);
               
            }
            if(inString.indexOf("led2") >= 0){
              
                  digitalWrite(1,LOW);            
                  delay(100);
               
            }
            
            
            // send a standard http response header
            client.println("HTTP/1.1 200 OK");
            client.println("Content-Type: text/html");
            client.println();
            
            for (unsigned char i = 0; i < 10; i++){
                        
              strcpy_P(buffer, (PGM_P)pgm_read_word(&(string_table[i])));
              client.println( buffer );
            }                
            
            client.println( analogRead (1)); // Reading and printing of sensor value 
            
            client.println( pgm_read_word(&(string_table[11])));
            client.println( pgm_read_word(&(string_table[12])));
            
            delay(100);
            
            client.stop();
        }
      }
    }
  }
}

You need to search the GET string for the index of "led1=", like your code kinda does. Then add the length of "led1=" to the index value. Read that position in the string. It will either be 'On' or 'Off'.
The page will send the variable like this
?led1=On
or
?led1=Off

SurferTim

I think I lost you at the beginning of you second phrase :s can you illustrate it with my code?

The easiest way is to search for the entire string. I changed the pin to digital 2 so it won't mess up the serial port.

if(inString.indexOf("led1=On") >= 0){
   digitalWrite(2,HIGH);
}
else if(inString.indexOf("led1=Off") >= 0){
   digitalWrite(2,LOW);
}