When you send form information with method="get"
,
the information from the form is put into string form and appended
to the CGI script’s URL.
This means that the string can contain only characters that
are valid in a URL. Blanks and certain punctuation such as question
marks, commas, number signs, etc. cannot appear in a URL.
To get around this problem, the browser collects the form information,
and then URL encodes the string before sending it off to the
server as part of the URL. Blanks are converted to plus signs (which
are legal), and any other non-valid characters are converted to a percent
sign followed by the two-digit hexadecimal equivalent. For example, a
comma is converted to %2C
and a number sign is converted to
%23
.
Let’s say your form has a field called
poetName
, and the user has typed
Alfred, Lord Tennyson
into that field.
Another field is nPoems
and the user has typed 20
into that field.
poetName=Alfred, Lord Tennyson
poetName=Alfred, Lord Tennyson&nPoems=20
poetName=Alfred%2C+Lord+Tennyson&nPoems=20