|
|
|||||||||
|
|
Feedback With FormsSo far, we had the option of getting data from the application transmitted to the browser of the user - what we still needed was a way to get commands from the user back to the application. This functionality can be implemented using standard HTML forms. Much as with the SSI functions, the Web page needs to contain the tags to build a FORM and indicate the name of the POST function to be executed within the Web server. Let's assume we have a form with a text field for user input and maybe a pull-down menu with a few items. Once the user hits the "Send" or "Submit" button, a POST request is sent to the HTTP server with all variable settings squeezed into a single ASCII line. The format of this line is the same as used when passing variables in URLs:
In case spaces are used in string variables, they have to be replaced by "%20". Once the HTTP server receives such a POST message, it locates the application function matching the post request and executes it. The TCP/IP software eases the search for a specific variable in this ASCII line by providing search functions that allow the application function for that FORM to easily detect the variables and their current settings and respond accordingly. Our example in listing 2 shows a function that is called by the HTTP server when a certain POST request is detected. In this case the variables named "d1" and "d2" are detected and used to switch on/off 2 LEDs.
[ Introduction
| Internet Connectivity Parameters | Case
Study ] |
ESAcademy, 2000 All materials |
||||||||