Form-Data Format

The format of the form data is a URL-encoded string containing a representation of the data contained in the HTML form, in the following format:

field0name=field0data&field1name=field1data&...&fieldnname=fieldndata
fieldiname is the name given to the ith field of the form. fieldidata is the data which the user selected [or the default value for that field if the user made no selection|modification] for the ith field of the form.

For instance, with a form like the following:

<FORM METHOD=POST ACTION="foo.cgi">
Foo: <INPUT TYPE=text NAME="foo"><BR>
Bar: <INPUT TYPE=text NAME="bar"><BR>
Select one: <SELECT NAME="age">
<OPTION selected>20
<OPTION>21
<OPTION>22
<OPTION>23
</SELECT><BR>
<INPUT TYPE=submit VALUE="Submit me!">
</FORM>

If for the text input "foo" the user entered "2 + 2 = 4", for the text input "bar" the user entered "Hello" and for the "age" selection the user left the default value of 20, then the form data would be represented as the string:

foo=2+%2B+2+%3D+4&baz=Hello&age=20

As with URL-Encoding, parsing this information is a relatively straightforward process, but it's usually more convenient to let a library do the decoding to a set of variables which the program can then easily use.