Need help with some logic in my sketch.

After working on this all day I think I'm making progress.

I've now got this:

#include <WiServer.h>
#include <string.h>

#define WIRELESS_MODE_INFRA 1
#define WIRELESS_MODE_ADHOC 2

#define ledPin1 5
#define ledPin2 6
#define ledPin3 9

// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[]    = {192,168,1,225};   // IP address of WiShield
unsigned char gateway_ip[]  = {192,168,1,1};   // router or gateway IP address
unsigned char subnet_mask[] = {255,255,255,0}; // subnet mask for the local network
const prog_char ssid[] PROGMEM     = {"The Tardis"};   // max 32 bytes
unsigned char security_type = 3;  // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2

// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"biggerontheinside"}; // max 64 characters

// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, // Key 0
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 1
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 2
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // Key 3
};

// setup the wireless mode; infrastructure - connect to AP; adhoc - connect to another WiFi device
#define WIRELESS_MODE_INFRA	1
#define WIRELESS_MODE_ADHOC	2
unsigned char wireless_mode = WIRELESS_MODE_INFRA;
unsigned char ssid_len;
unsigned char security_passphrase_len;

// Webserver static content ------------------------------------------------
const prog_char wbHtmlOpen[] PROGMEM = {"<html>"};
const prog_char wbHeadOpen[] PROGMEM = {"<head>"};
const prog_char wbTitle[] PROGMEM = {"<title>Door Opener</title>"};
const prog_char wbMetaRefresh[] PROGMEM = {"<HTML><HEAD><meta http-equiv='REFRESH' content='10;url=/'></HEAD></HTML>"};
const prog_char wbDoor1Open[] PROGMEM = {"<h1>Door 1 Open</h1>"};
const prog_char wbDoor1Closed[] PROGMEM = {"<h1>Door 1 Closed</h1>"};
const prog_char wbHeadClose[] PROGMEM = {"</head>"};
const prog_char wbBodyOpen[] PROGMEM = {"<body>"};
const prog_char wbOPEN[] PROGMEM = {"<h1>TEST</h1>"};
const prog_char wbDivPatterns[] PROGMEM = {"<center>GARAGE DOOR OPENER<center>\n<center>

"};
const prog_char wbDivPatterns2[] PROGMEM = {"<input type=\"submit\" onclick=\"location=\'/?LED0 \'\" value=\"Button 1\">

<input type=\"submit\" onclick=\"location=\'/?LED1 \'\" value=\"Button 2\">

<input type=\"submit\" onclick=\"location=\'/?LED2 \'\" value=\"Button 3\">
"};
const prog_char wbBodyClose[] PROGMEM = {"</body>"};
const prog_char wbHtmlClose[] PROGMEM = {"</html>"};


int incomingByte = 0;
int webnum = -1;
int num = -1;
int option1State = 0;
int circuit1State = 0;
int test = 0;

// Methods ------------------------------------------------------------------

boolean sendPage(char* URL) {
  
 if (URL[1] == '?' && URL[2] == 'L' && URL[3] == 'E' && URL[4] == 'D') //url has a leading /
 {incomingByte = URL[5];
 if(incomingByte >= 48 && incomingByte <=57){
   webnum = incomingByte - 48;
 }
 
  WiServer.println_P(wbHtmlOpen);
  WiServer.println_P(wbHeadOpen);
  WiServer.println_P(wbTitle);
  WiServer.println_P(wbMetaRefresh);
  WiServer.println_P(wbHeadClose);
  WiServer.println_P(wbBodyOpen);
  WiServer.println_P(wbDivPatterns);
  WiServer.println_P(wbDivPatterns2);
  WiServer.println_P(wbBodyClose);
  WiServer.println_P(wbHtmlClose);
  return true;
}
}

void numDisplay(int num){
  if(num == 0){
    test++;
     if(test == 1){
     if ((option1State == 0) && (circuit1State == 0)){
       WiServer.print(wbDoor1Open);
       option1State = 1;
       circuit1State = 1;
       digitalWrite(ledPin3, LOW);
       }
    }  
  if(test == 2){
     if ((option1State == 1) && (circuit1State == 1)){
       WiServer.print(wbDoor1Closed);
       option1State = 0;
       circuit1State = 0;
       test = 0;
       digitalWrite(ledPin3, HIGH);
      }
    }
}
  if(num == 1){
  
  }
  if(num == 2){

  }
}

void setup() {
//setup leds
 pinMode(ledPin1, OUTPUT);
 pinMode(ledPin2, OUTPUT);
 pinMode(ledPin3, OUTPUT);
 WiServer.init(sendPage);
}

void loop() {
  num = webnum;
  numDisplay(num);
   WiServer.server_task();
   delay(100);
}

However the check

  if(num == 0){
    test++;
     if(test == 1){
     if ((option1State == 0) && (circuit1State == 0)){
       WiServer.print(wbDoor1Open);
       option1State = 1;
       circuit1State = 1;
       digitalWrite(ledPin3, LOW);
       }
    }  
  if(test == 2){
     if ((option1State == 1) && (circuit1State == 1)){
       WiServer.print(wbDoor1Closed);
       option1State = 0;
       circuit1State = 0;
       test = 0;
       digitalWrite(ledPin3, HIGH);
      }
    }
}

Just makes the LED blink. Any suggestions?