Form

Whenever the form variable is mentioned in a PSP page a util.FieldStorage instance will be automatically created. It will have everything necessary to handle form submitted data.

A form can send data to the server using either the get or the post method. The chosen method is transparent to the PSP script and both will be treated the same.

This html page will send its only field using the get method:

<html><body>
<!-- method can be get or post -->
<form action="" method="get">
<p>Type Field One: <input type="text" name="field_one">
<input type="submit" value="Submit"></p>
</form>
</body></html>

The get method will send data as part of the URL as shown in the sent HTTP message:

GET /?field_one=submitted_data HTTP/1.1
Host: localhost:8080

Other headers were omitted. If the method used was post then the HTTP message would be:

POST / HTTP/1.1
Host: localhost:8080
Content-Type: application/x-www-form-urlencoded
Content-Length: 24

field_one=submitted_data

With the post method the data is sent in the message body in instead of part of the URL.