Get values from web browser

Hello Everyone!

I’m a new in Arduino programming and this is the first bigger project and i’m in trouble: i would like to make a irrigation system. I’d like to get value from the simply html page therefor i maked the function what cutting the URL address this is the urlCuttingFunction. This function make objects of Foliak class than return a pointer to an array of Foliak objects. The problem is when i submit at the html page the browser is break. I sure about the problem is not in the urlCutting method i think in the return pointer or something like this. Here is my code, and i attach my Folia librarie. I hope you understand what i want and you can help me.

#include <SPI.h>
#include <Ethernet.h>
#include <String.h>
#include <Folia\Folia.h>

// MAC address from Ethernet shield sticker under board
byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 0, 101); // IP address, may need to change depending on network
EthernetServer server(80); // create a server at port 80
String s;

Foliak* urlCuttingFunction(String s)
{
	int index = 0;
	char vname[10];
	char vval[10];
	int vni = 0;
	int vvi = 0;
	Foliak* foliakArray = new Foliak[3];
	int arrayIndex = 0;

	while (s[index++] != '?'); // Az url-t tároló S tömb indexét beállítjuk a kérdőjel UTÁN-ra.

	while (s[index] != ' ') // A művelet a HTTP felirat előtti SPACE karakterig megy.
	{
		/************************************************************************************/
		vni = 0;
		vvi = 0; // A változó nevét és értékét tároló tömb, index változóinak 0-ra állítása

		while (s[index] != '=') vname[vni++] = s[index++]; // A változó nevének kiolvasása
		vname[vni] = '\0'; index++;
		foliakArray[arrayIndex].setFnev(vval);
		/************************************************************************************/

		if (s[index] == '&') { // Ha ez igaz akkor az addott változót üresen küldték el, tehát az értéke 0
			vval[vvi] = 0;
		}
		else {

			/************************************************************************************/
			while (s[index] != '&' && s[index] != ' ') vval[vvi++] = s[index++]; // A változó értékének kiolvasása
			vval[vvi] = '\0';
			foliakArray[arrayIndex].setFido(atoi(vval));
			arrayIndex++;
		}
		/************************************************************************************/
		if (s[index] == '&') index++;
		/*Serial.println();
		Serial.print(vname); Serial.print(" = "); Serial.print(vval);*/
	}
	return foliakArray;

}

void setup()
{
	Ethernet.begin(mac); // initialize Ethernet device
	server.begin();           // start to listen for clients
	Serial.begin(9600);
	Serial.print(Ethernet.localIP());

}

void loop()
{
	Foliak * p;
	EthernetClient client = server.available();  // try to get client

	if (client) {  // got client?
		s = "";
		
		boolean currentLineIsBlank = true;
		while (client.connected()) {
			if (client.available()) {   // client data available to read
				char c = client.read(); // read 1 byte (character) from client
				s += c;

				// last line of client request is blank and ends with \n
				// respond to client only after last line received
				if (c == '\n' && currentLineIsBlank) {

					client.println("<html><head></head><body>");
					client.println("<h1><CENTER>Aduino & Ethershield Webserver</CENTER></h1>");
					client.println("<CENTER><form method=get>D:<input type=text size=3 name=F01>D:<input type=text size=3 name=F02>&nbsp;D:<input type=text size=3 name=F03><input type=submit value=submit></form></CENTER></body></html>");

					if (s.indexOf('?') > -1)
					{
						p = urlCuttingFunction(s);
						p[0].eredmeny();
						delay(1000);

					} // end if ?

					break;
				}
				// every line of text received from the client ends with \r\n
				if (c == '\n') {
					// last character on line of received text
					// starting new line with next character read
					currentLineIsBlank = true;
				}
				else if (c != '\r') {
					// a text character was received from client
					currentLineIsBlank = false;
				}

			} // end if (client.available())
		} // end while (client.connected())

		delay(1);      // give the web browser time to receive the data
		client.stop();  // close the connection
	} // end if (client)
	delete[] p;
} // end loop

Folia.zip (674 Bytes)