Comparing String of characters from http GET request to int and boolean array

Im attempting to add ethernet control to an old RS232 sketch that you guys helped me with tremendously. Old sketch located here: map 4 pins so each one has a position in a string received via serial port? - #26 by n8huntsman - Programming Questions - Arduino Forum
That will explain why Im using the arrays that Ive chosen.
I've got a basic ethernet server up on the Arduino Mega with ethernet shield. Using the arrays that everyone helped me with many years ago I wrote some simple If/Then statements that should work with the existing code. For now, I started basic and don't have the RS232 control but left the arrays intact so that I can add it as soon as I get my logic working.

The intent is for the server to have discrete ON/OFF command buttons such as 0x31ON, and also a status indicator (not yet implemented) while the RS232 code will be simple toggles with no feedback.

Im pretty sure the reason it's not working is because of data types not matching in my statements, integers, bytes, decimal, hex, etc. Can someone help me out with the following code and understanding what types of data im receiving and how to compare it to the data in the existing arrays?

Thanks

#include <SPI.h>
#include <Ethernet.h>
// following 3 includes from older code.  might be needed eventually for serial control
//#include <Server.h>
//#include <Client.h>
//#include <Udp.h>
//macro for calculating the length of arrays
#define ARY_LEN(a) (sizeof(a)/sizeof(a[0]))
//array called "state"
boolean state [] = {HIGH, LOW, LOW, LOW};
//array called "zone" that defines the zone being toggled by the remote or changed via ethernet
int zone [] = {0x31, 0x32, 0x33, 0x34};
//int eth_command [] = {1, 2, 3, 4}; //might need to use this to check the ethernet command instead of zone[] since those are hex values?
//get the length of the "zone" array and call it "num_zones"
const int NUM_ZONES = ARY_LEN(zone);
// array called "pins" that defines which pins are used
int pins [] = {8, 9, 10, 11};
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 199 };      // ip in lan
byte gateway[] = { 192, 168, 1, 1 };      // internet access via router
byte subnet[] = { 255, 255, 255, 0 };                   //subnet mask
EthernetServer server(80);                                      //server port

String readString;
void setup()
{
  //start Ethernet
  Ethernet.begin(mac, ip, gateway, subnet);
  server.begin(); //this was missing in previous version (P4)

  //enable serial data print
  Serial.begin(9600);
  //sets pins defined in "pins" array as outputs
  for (int i = 0; i < NUM_ZONES; i++) digitalWrite(pins [i], state [i]);
  for (int i = 0; i < NUM_ZONES; i++) pinMode(pins [i], OUTPUT);
}
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; //replaces readString.append(c);
          //Serial.print(c); //prints GG
        }
        //if HTTP request has ended
        if (c == '\n')
        {

          //removed the following per zoomkat example
          //Serial.println(readString); //see what was captured
          //dirty skip of "GET /favicon.ico HTTP/1.1"
          //if (readString.indexOf("?") < 0)
          //{
          //skip everything
          //Serial.print("skipping everything");
          //}
          //else

          // now output HTML data starting with standard header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          //controlling led via checkbox
          client.println("<HTML>");
          client.println("<HEAD>");
          client.print("<font size='5'>Speaker Selector ");
          client.println("</HEAD>");
          client.println("<BODY>");
          client.println("
");
          //only created two buttons for now. more to come
          client.println("<input type=submit value=Speaker&nbsp;1&nbsp;-&nbsp;ON style=width:120px;height:45px onclick=location.href='/?0x31HIGH;'>");
          client.println("
");
          client.println("<input type=submit value=Speaker&nbsp;1&nbsp;-&nbsp;OFF style=width:120px;height:45px onclick=location.href='/?0x31LOW;'>");
          client.println("
");

          //future use for getting status - printing LED status - ignore for now
          //client.print("<font size='5'>Speaker 1 Status: ");
          //if ()
          //client.println("<font color='green' size='5'>ON");
          //else
          //client.println("<font color='grey' size='5'>OFF");
          //clearing string for next read

          client.println("</FORM>");
          client.println("
");
          client.println("</BODY>");
          client.println("</HTML>");
          delay(1);
          //stopping client
          client.stop();
          for (int i = 0; i < NUM_ZONES; i++)

            //lets check if LED should be lighted
          {
            Serial.print(readString);  //check to see what was received

            //i dont thing the following if will work because its comparing two different data types
            if (readString.indexOf(zone[i]) > 0) //if zone[i] (any command from array) is found anywhere in the readstring
            {
              Serial.print(readString.indexOf(zone[i]));  //check to see what position zone[i] is in in the readstring if at all. >0 means it exists
              //check to see if we need to toggle the state of ith zone

              //i dont thing the following if will work because its comparing two different data types again
              if (readString.indexOf(state[i]) == 0) //if  state[i] is not found in readstring
              {
                state[i] = !state[i];//state in readstring was different from state[i] so we need to invert state
                digitalWrite(pins [i], state [i]);
              }
            }
          }
          readString = "";
        }
      }
    }
  }
}

i believe you would be better off separating the reading input from generating input.

loop() can, besides checking if a client is connected check for input from the client and capture it in an array.

when you've recognized the end of the html request, call a function to process what was received.

based on what was receive, call some sub-function to perform some action.

i'm guessing you want to find the line contain "GET" in the captured data and based on it perform some action.

Currently I send a 0x31 via serial port and it compares the received data to the zone*. If found, inverts the state*
What Im trying to do is similar. Send 0x31HIGH via GET. I want to compare zone to readstring. If any of the values in zone are found in readstring, then i want to compare state to readstring, and if state isn't found, invert state*.*
Currently, when I serial.print readstring, I get the following returned:
GET /?0x31LOW; HTTP/1.1
GET /favicon.ico HTTP/1.1
I don't think my comparison is correct even though it does seem to find zone[0] in readstring, it is also finding zone[1], zone[2], and zone[3] even though I only sent 0x31.
After that it doesnt do anything so I think it is not finding 'HIGH' or 'LOW' in
the boolean state [] = {HIGH, LOW, LOW, LOW}; array
I think that's because HIGH and LOW is interpreted as a 0 or 1 but not sure what to do about it?

are you comparing an integer value, 0x31, in order to find a ascii string "0x31"?

you could make zone an array of strings

char * zone [] = { "0x31", "0x32", "0x33", "0x34"};

When I initially wrote the code, I sent an ascii 1 via my home automation controller. In test code I said:

int zone = Serial.read();
serial.print(zone)

and saw 0x31 in my console.
That's when I made the array int zone [] = {0x31, 0x32, 0x33, 0x34};
I can play around with it some more... just getting stuck a bit.
Starting to wonder if this doesnt do what I think it does:

//if zone[i] (any command from array) is found anywhere in the readstring, return position
if (readString.indexOf(zone[i]) > 0)

compare the numeric values to the ascii code for 0, 1,2, ...

the numeric value for ascii '1' is 0x31

if you receive a string containing "0x31" you need to compare it to "0x31" or 0x30, 0x78, 0x33, 0x31

I understand the ascii to hex. I tried using 0x31 in my zone array and in the html button but was getting a indexOf -1 when looking for the array values in the readstring string. I did serial.print(readstring) and could clearly see the 0x31 though.

Im going to create another array using char eth_zone [] = {'A', 'B', 'C', 'D'}; and see what happens