Budget 9x lets the user enter his or her own financial details, i.e. income and expenditure. It will then calculate how the last Budget would affect these. Budget 9x is here at the BBC site and here at the IFS site.
http://www.ifs.org.uk/index.htm
The Internet uses the address part of the URL to find the right server, and routes the rest of the URL to it. It arrives as one line:
GET index.htm HTTP/1.0
GET
is one of several possible HTTP (Web protocol) commands - it tells the
server to send back HTML corresponding to the name that follows.
HTTP/1.0
is just an identifier telling the server which HTTP protocol the browser
is using. Version 1.0 is the most common, but there are others.
<FORM ACTION=calculate METHOD=GET> First number: <INPUT TYPE=TEXT NAME=a VALUE=0><BR> Second number: <INPUT TYPE=TEXT NAME=b VALUE=0><BR> <INPUT TYPE=SUBMIT VALUE="Add the numbers"> </FORM>
When the user submits this form, the server will receive the following request (if her or she has entered the values 3 and 4 respectively):
GET calculate?a=3&b=4 HTTP/1.0The browser sends the name after
ACTION
as the new URL, and
follows it by a ?
and the data from the fields as a sequence
of name=value pairs separated by &
characters.
calculate
that
the request is for a program to be run. It could then extract the data
following the ?
, and pass it to the program by writing it to
a temporary file which the program must read. Or, if there isn't much data,
via the program's command line.
This page contains three links, all of which point at pages whose content will depend on the session they belong to.
Welcome to Amazon
The server would allocate the user a unique session identifier when he or she starts. It would then embed this in every URL, for example:
<B>Welcome to Amazon</B> <P> <UL> <LI><A HREF="http://www.amazon.com/add/474052z">Add a book to your order</A>. <LI><A HREF="http://www.amazon.com/view/474052z">View your order</A> <LI><A HREF="http://www.amazon.com/pay/474052z">Pay for your order</A> </UL>Then if the user clicks on any of these links, the server will receive the identifier, and can use it to find the state of the relevant session. This could be stored in a database, for example.
To prevent this, we can use "redirection commands". When the server generates the entry page, it does not immediately send it back. Instead, it sends the browser a command telling it to request another URL, for example
http://www.amazon.com/new/474052zThe server then receives a request for this second URL, and then sends back the entry page. If the user then goes back to the entry page later, the server will recognise the
new/474052z
in the request, and know it
must
send back the same page, rather than generating a new one with a different
identifier.
Server-side includes are a simple example of this. They are implemented by many servers, which
recognise pseudo-HTML commands such as (for example)
<!--#include file="address.html"-->
to include the contents of
the named file at that point in the Web page. This is useful for inserting
pieces of HTML that will be the same between many pages, such as company
logos.
23rd April 1998
[ Jocelyn Ireson-Paine's Home Page | Departamento de Informática da Universidade do Minho]