TCP/IP Lean: Web Servers for Embedded Systems, Second Edition

A classic Web server simply provides Web pages without alteration and is essentially just a file server. Modern Web servers can alter Web pages on the fly or create the pages from scratch each time they are requested. The umbrella term for this facility is common gateway interface (CGI), which, because of the large amount of string manipulation involved, is usually implemented on a powerful multi-user system running a language, such as Perl, that is well-suited for the job.
I need the ability to insert live data into Web pages, but I won't be using a powerful multiuser system or the Perl language, so I need to look carefully at what CGI offers the embedded systems developer and whether there are ways of achieving dynamic content on a relatively modest system. To do this, I'll look at sample pages that could be used to control real-world signals, and how they could be linked to real devices.
So far, the Web displays have been static: you click on a hyperlink and get another page. Now I'll start to introduce displays with greater interactive capability.
To start simply, I'll create a page with a switch and lamp: the switch toggles when clicked and turns the lamp on or off. The easiest way to do this is to create two HTML pages, both with the button and lamp graphics in the same place: one with the lamp and switch on and the other with them off (Figure...