Connected: An Internet Encyclopedia
8.2.4. Example Form Submission: Questionnaire Form

Up: Connected: An Internet Encyclopedia
Up: Requests For Comments
Up: RFC 1866
Up: 8. Forms
Up: 8.2. Form Submission
Prev: 8.2.3. Forms with Side-Effects: METHOD=POST
Next: 9. HTML Public Text

8.2.4. Example Form Submission: Questionnaire Form

8.2.4. Example Form Submission: Questionnaire Form

Consider the following document:

    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <title>Sample of HTML Form Submission</title>
    <H1>Sample Questionnaire</H1>
    <P>Please fill out this questionnaire:
    <FORM METHOD="POST" ACTION="http://www.w3.org/sample">
    <P>Your name: <INPUT NAME="name" size="48">
    <P>Male <INPUT NAME="gender" TYPE=RADIO VALUE="male">
    <P>Female <INPUT NAME="gender" TYPE=RADIO VALUE="female">
    <P>Number in family: <INPUT NAME="family" TYPE=text>
    <P>Cities in which you maintain a residence:
    <UL>
    <LI>Kent <INPUT NAME="city" TYPE=checkbox VALUE="kent">
    <LI>Miami <INPUT NAME="city" TYPE=checkbox VALUE="miami">
    <LI>Other <TEXTAREA NAME="other" cols=48 rows=4></textarea>
    </UL>
    Nickname: <INPUT NAME="nickname" SIZE="42">
    <P>Thank you for responding to this questionnaire.
    <P><INPUT TYPE=SUBMIT> <INPUT TYPE=RESET>
    </FORM>

The initial state of the form data set is:

    name
            ""

    gender
            "male"

    family
            ""

    other
            ""

    nickname
            ""

Note that the radio input has an initial value, while the checkbox has none.

The user might edit the fields and request that the form be submitted. At that point, suppose the values are:

    name
            "John Doe"

    gender
            "male"

    family
            "5"

    city
            "kent"

    city
            "miami"

    other
            "abc\ndefk"

    nickname
            "J&D"

The user agent then conducts an HTTP POST transaction using the URI `http://www.w3.org/sample'. The message body would be (ignore the line break):

   name=John+Doe&gender=male&family=5&city=kent&city=miami&
   other=abc%0D%0Adef&nickname=J%26D


Next: 9. HTML Public Text

Connected: An Internet Encyclopedia
8.2.4. Example Form Submission: Questionnaire Form