In this section we will be looking at how client-server computing works, as that is what the original purpose of forms were for. We will not be using server-side processing in this book, but if there is interest in this topic let me know and I may do a future book on the topic. While you may skip this section, this will give you a bit of the foundation if you do wish to explore server-side processing in the future.
The predominant method of working with networks is something called the Client-Server Architecture. The basic idea is that you have several client machines that access resources from a dedicated machine for handling the resources being requested. This dedicated machine is known as the Server. What makes a machine a server? It simply has server software running on it. This means that if you set up a database on your machine and allow other computers to access this database, you have a server. Later on in this book we will be setting up a simple HTTP server, this also magically changes your machine into a server.
While it is true that any machine that is capable of running server software can be used as a server, if that server is being used for non-trivial purposes, then it is likely going to be a machine designed to be used for that purpose. The requirements of a server would depend on what type of services the machine was providing, but most industrial servers tend to run versions of an operating system designed for servers and are tuned for high network and storage performance. Fault tolerance is also a consideration. This can take many forms, with the extreme being having backup machines that take over if there is an issue. Having multiple hard drives, power supplies, and network connections is also common.
The purpose of server software is simply to handle a service. This could be for anything as long as one or more client machines obtain information from it. Common server functions being handling files, databases, email, chat, forums, or keeping a multi-player game world in synch. For web sites, the client is any computer running a browser while the server is any of the numerous HTTP servers. The most well-known server is the Apache HTTPServer, which is likely what your site host would be using. The purpose of the HTTP server is simply to send back the requested page but as many web-based activities require more interaction, the HTTP protocol has GET and POST commands. GET is a request that is part of the URL used to access the web site, with extra parameters for providing information to the server to help the server decide what to send back to the client. The POST command was designed with forms in mind, and hides the information being sent to the server as part of the HTTP Request instead of being part of the URL.
HTTP Servers handle GET and POST requests need to be processed, and this was originally done by having support scripts or programs that used the Common Gateway Interface (CGI) standard. Today, this is still the case, but often the server will have modules that allow the requested page to process the request. Whenever you see a page that end with something like PHP, ASP, or JSP instead of HTML, you have a specially written page that generates the resulting web page that you get back.
Generally, whenever you fill out information in a form, that information gets sent to the server for processing. However, JavaScript can access form fields directly, so it is possible to process a form right on the client.
The client-server architecture is not the only way to set up things but is the way HTTP is designed. Another way of exchanging information is the peer-to-peer model. This has every machine that wants to exchange information with each other be both a server and a client. To simplify the discussion, we will use the generic term node to describe a machine on the network. Nodes in a peer-to-peer network share information, such as music files, with other nodes on the network. Any machine that is part of the network can request data from other machines on the network and to speed things up, you can have the situation where one machine shares parts of a file with several machines that want that file and then those machines share their parts with the other machines in the network.
The last model that we will look at is the publish-subscribe model. This model was used by news groups and other similar services. The idea is that we have publishers, who send information to brokers for people interested in that type of information (topics). Subscribers contact their broker periodically to find out if there is any new data in the topics they are interested in and receive that information. This is essentially the client/server architecture but with some decoupling between the publisher and the subscriber. It also has the advantage that a publisher just needs to publish once to one broker, and that broker will pass the message to other brokers spreading out the workload across many machines.
So now that you have a bit of an introduction to the idea of a server processing forms, let’s take a look at how to create a form in HTML.
This chapter's summary cheat sheet.
How forms are traditionally used.
How to set up a form in HTML.
Getting text input from the user.
Making your input fields more specific and semantic.
Making forms look more like printed forms.
Coming September 15th.
Coming September 22nd.
Coming September 29th.
Coming October 6th.
Coming October 20th.
Coming October 27th.
Coming November 3rd.
Coming November 17th.
Coming November 24th.
Coming December 1st.
Coming December 8th.
Coming December 15th.