Having issue writing code from Arduino to html

Hello, I know this is a long post but I have tried everything and this is my last option at the moment. For reference I found this code in sketch 10-02 of the book Arduino Programming: “getting started with sketches”. I am working with a Ethernet Shield V2.0 so I had to change the beginning code a bit. The purpose of this sketch is to control arduino pins over the internet. The book promises a html sheet that has pin selectors that you toggle with a mouse but all I get when I run the code is an html page with a title.
I think is has something to do with something getting lost in translation when the arduino software sends the html since looking at the html source code in the page all the html code stops after . So anyway here is the code:

#include <SPI.h>
#include <EthernetV2_0.h>

byte mac[] = { 0xDE, 0xAA, 0xBE, 0xEF, 0xFE, 0xED }; 
IPAddress ip(192,168,0,16);

EthernetServer server(80);
#define W5200_CS  10
#define SDCARD_CS 4

int numPins = 5;
int pins[] = {3, 4, 5, 6, 7};
int pinState[] = {0, 0, 0, 0, 0};
char line1[100];

void setup() {
  
  for (int i = 0; i < numPins; i++)
  {
    pinMode(pins[i], OUTPUT);
  }
  
  Serial.begin(9600);
   pinMode(SDCARD_CS,OUTPUT);
   digitalWrite(SDCARD_CS,HIGH);
  Ethernet.begin(mac, ip);
  server.begin();
  Serial.print("server started on: ");
  Serial.println(Ethernet.localIP());
}

void loop() {
  

  EthernetClient client = server.available();

  if (client) {
    while (client.connected())
    {
     readHeader(client);
     if (!pageNameIs("/")){
      client.stop();
      return;
     }
     
      client.println("HTTP/1.1 200 OK"); 
      client.println("Content-Type: text/html");
      client.println();

      // send the body
      client.println("<html><body>");
      client.println("<h1>Output Pins</h1>");
      client.println("<form method = 'GET'>");
      setValuesFromParams();
      setPinStates();
      for (int i = 0; i < numPins; i++){
        writeHTMLforPin(client, i);
      }
      client.println("<input type='submit' value='Update'/>");
      client.println("</form>");
      client.println("</body></html>");
      client.stop();
    }
  }  
}

void writeHTMLforPin(EthernetClient client, int i){
  
  client.print("<p>D");
  client.print(pins[i]);
  client.print(" <select name='");
  client.print(i);
  client.println("'>");
  client.print("<option value='0'");
  
  if (pinState[i] == 0){
    client.print(" selected");
  }
  client.println(">Off</option>");
  client.print("<option value='1'");
  
  if (pinState[i] == 1)
  {
    client.print(" selected");
  }
  client.println(">On</option>");
  client.println("</select></p>");
  
}

void setPinStates(){
  for (int i = 0; i < numPins; i++){
    digitalWrite(pins[i], pinState[i]);
  }
}

void setValuesFromParams(){
  for (int i = 0; i <numPins; i++){
    pinState[i] = valueOfParam( i + '0');
  }
}

void readHeader(EthernetClient client){
  // read first line of header
  char ch;
  int i = 0;
  while (ch != '\n'){
    if(client.available()){
      ch = client.read();
      line1[i] = ch;
      i++;
    }
  }
  line1[i] = '\0';
  Serial.println(line1);
}

boolean pageNameIs(char* name){
  // page starts at char pos 4
  // ends with space
  int i = 4;
  char ch = line1[i];
  while(ch != ' ' && ch != '\n' && ch != '?'){
    if(name[i-4] != line1[i]){
      return false;
    }
    i++;
    ch = line1[i];
  }
  return true;
}

int valueOfParam(char param){
  for ( int i = 0; i < strlen(line1); i++){
    if (line1[i] == param && line1[i+1] == '='){
      return (line1[i+2] - '0');
    }
  }
  return 0;
}

Stripping down your sketch to the basics gave me a webpage where I can turn on/off D3 - D7.

int numPins = 5;
int pins[] = {3, 4, 5, 6, 7};
int pinState[] = {0, 0, 0, 0, 0};


void writeHTMLforPin(int);

void setup() {
  
  for (int i = 0; i < numPins; i++)
  {
    pinMode(pins[i], OUTPUT);
  }
  
  Serial.begin(9600);

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

      // send the body
      Serial.println("<html><body>");
      Serial.println("<h1>Output Pins</h1>");
      Serial.println("<form method = 'GET'>");

      for (int i = 0; i < numPins; i++){
        writeHTMLforPin(i);
      }
      Serial.println("<input type='submit' value='Update'/>");
      Serial.println("</form>");
      Serial.println("</body></html>");



}

void loop() {
  
}

void writeHTMLforPin(int i){
  
  Serial.print("<p>D");
  Serial.print(pins[i]);
  Serial.print(" <select name='");
  Serial.print(i);
  Serial.println("'>");
  Serial.print("<option value='0'");
  
  if (pinState[i] == 0){
    Serial.print(" selected");
  }
  Serial.println(">Off</option>");
  Serial.print("<option value='1'");
  
  if (pinState[i] == 1)
  {
    Serial.print(" selected");
  }
  Serial.println(">On</option>");
  Serial.println("</select></p>");
  
}