Tidying up code

Hi everyone,
i am trying to make a web server with an arduino mega. I have no programming knowledge, but i like a lot the things you can accomplish with an controller like arduino. Till now i thing i am on a good path, but i would like to know how i could tide up my code as i have a lot of code. In the attachments below you will find my code and you will immidiatly understand what i mean.
Thank you in advance.

No attachments.

Maybe read How to use the Forum

...R

Here it is

Call buttons.txt (22.8 KB)

You should always do a Tools > Auto Format on your code. That's the easiest form of tidying up and really helpful. If you're using the Arduino Web Editor you will not have access to this useful tool so I recommend using the standard IDE instead if possible. You can download it for free from http://www.arduino.cc/en/Main/Software.

Does this look correct for the LED_state part??

//LEDS
int i;
for (i = 0; i < 25; i++)
{
   if (StrContains(HTTP_req, "LED26=1")) {
   LED_state[i] = 1;  // save LED state
   digitalWrite(7, HIGH);
 }
 else if (StrContains(HTTP_req, "LED26=0")) {
   LED_state[i] = 0;  // save LED state
   digitalWrite(7, LOW);
 }
}

If yes how i also change the LEDnumber= part ?
Thank you for pointing me in the right direction.

Sorry about my posts , but when i try to edit them so i can include my code in `` it says i have to try in 5 minutes!!!!!!!

I can not understand why people have to be so aggressive.
If you don't want or do not like what you see, don't bother replying.
I am new, i read the rules and yes i made a mistake,people do mistakes, but i dont hink there is a reason to be so aggressive and no one is bitching about having to wait.
That is the way this forum works and i accepted it!!!!!
Have a good night everyone and thank you for the help.

The 5 minute limit can be a real PITA but it was introduced to stop spammers and it apparently works well for that. It goes away after you have posted 100 times.

The first improvement you should make to the code attached to Reply #2 is convert it to use arrays. That will probably reduce the size by 75% AND reduce the risk of silly typos.

A great way to broaden your knowledge is to read as many Forum Threads as you can. That way you will be exposed to good and bad ideas and almost certainly come across ideas that you had not thought of but which can be adopted and adapted for your own purposes.

...R