Help with reading HTML Forms data

Hello all,

I am having some trouble with my latest project.

I am trying to use an HTML form to capture data using an Ethernet shield, and relaying that information through a yaler server. I am using an arduino duemilanove, with the arduino Ethernet shield.

#include <Dhcp.h>
#include <Dns.h>
#include <EthernetClient.h>
#include <EthernetServer.h>
#include <EthernetUdp.h>
#include <util.h>

// Copyright (c) 2013, Oberon microsystems AG, Switzerland
// All rights reserved

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


// Enter a MAC address for your controller below.
// Some Ethernet shields have a MAC address printed on a sticker
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// Local EthernetServer at http://LOCAL_IP/ (e.g. http://192.168.0.7/)
//EthernetServer server(80);

// Get a free relay domain at http://yaler.net/ to replace RELAY_DOMAIN below
// Public YalerEthernetServer is accessible at http://RELAY_DOMAIN.yaler.net/
YalerEthernetServer server("try.yaler.net", 80, “XXXXX-XXXX-XXXX");
String readString = String(100); 


void setup() {
  Serial.begin(9600);
  Serial.println("Aquiring IP address...");
  if (Ethernet.begin(mac) == 0) {
    Serial.println("DHCP failed.");
  } 
  else {
    Serial.println(Ethernet.localIP());
    server.begin();
  }
}

void sendResponse(EthernetClient client) {
 //create the web interface.  
  client.println("HTTP/1.1 200 OK");
  client.println("Content-Type: text/html");
  client.println();
  
  client.print("<html><body>");
  client.println("<form method=get name= pin> PIN: <input type=password name=pwd> 
");
  client.println("<input type=submit value=submit> </form>");
  client.println("</body></html>");
}

void loop() 
{
  EthernetClient client = server.available();
  if (client && client.connected()) {
    client.find("\r\n\r\n"); // Consume incoming request
    sendResponse(client);

    Serial.println("Web Page Sent");
    
    delay(1); // Give the Web browser time to receive the data
    
      char c = client.read();
      
      Serial.println(c);
      
      if (readString.length() < 100)
      {
        readString.concat(c);
      }
      Serial.println("String = ");
      Serial.println(readString);
    client.stop();
  }
  else
  {
    Serial.println("FAIL");
  }
}

I get the following in the serial monitor.

Aquiring IP address...
192.168.1.XXX
Web Page Sent

(Text entered, submit clicked)

ÿ
String =
100ÿ

I can see that the client.read() function is not working, as the value of the string never changes, regardless of the text entered. But I have tried everything that I can think of.

I am not tremendously experienced with the Ethernet shield, only having done some limited web interfacing, never with a form.

Thanks in advance for your help!

Server text box test code.

//zoomkat 12-08-12
//get submit box 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 or use a '
//address will look like http://192.168.1.102:84 when submited
//for use with W5100 based ethernet shields
//note that the below bug fix may be required

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

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

String readString; 

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

void setup(){

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

  //enable serial data print 
  Serial.begin(9600); 
  Serial.println("server text box test1"); // 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);
        } 

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

          ///////////////
          Serial.println(readString); //see what was captured

          //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='/' method=get >"); //uses IP/port of web page

          client.println("Pin 5 'on5' or 'off5': <INPUT TYPE=TEXT NAME='LED' VALUE='' SIZE='25' MAXLENGTH='50'>
");

          client.println("<INPUT TYPE=SUBMIT NAME='submit' VALUE='Change Pin 5!'>");

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

          client.println("
");

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

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

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

        }
      }
    }
  }
}