introduction to web programming The POST Method The POST method of input was the other important change brought about by the introduction of HTTP/1.0.

The POST method allowed web browsers to send an unlimited amount of data to a web server by allowing them to tag it on to an HTTP request after the request headers as the message body.

Typically, the message body would be our old familiar encoded URL string after the question mark (?).

Thus, it would not be strange for a web server to get a POST request that looked something like the following:

    POST /cgi-bin/phone_book.cgi HTTP/1.0
    Referer: http://www.somedomain.com/Direcory/file.html
    User-Agent: Mozilla/1.22 (Windows: I: 32bit)
    Accept */*
    Content-type: application/x-www-form-urlencoded
    Content-length: 29

    name=Selena+Sol&phone=7700404

Notice that the "Content-length" request header is equal to the number of characters in the body of the request. This is important because a CGI script could easily parse through the variables in the body using the length.

Of course, as with the GET method, the user never needs to deal with the protocol itself. Instead, the browser does all the work of preparing the POST request headers and body.

So the million-dollar question is how does the browser get the name/value pairs to put into the HTTP message body?

The answer to that is HTML Forms.

Previous | Next | Table of Contents