You want to write a script that gathers input from a user.
Create a fill-in form from within your script and send it to the user. The script can arrange to have itself invoked again to process the form’s contents when the user submits it.
Web forms are a convenient way to allow your visitors to submit information, for example, to provide search keywords, a completed survey result, or a response to a questionnaire. Forms are also beneficial for you as a developer because they provide a structured way to associate data values with names by which to refer to them.
A form begins and ends with
</form> tags. Between those tags, you can
place other HTML constructs, including special elements that become
input fields in the page that the browser displays. The
<form> tag that begins a form should include
tells the browser what to do with the form when the user submits it.
This will be the URL of the script that should be invoked to process
the form’s contents. The
attribute indicates to the browser what kind of HTTP request it
should use to submit the form. The value will be either
depending on the type of request you want the form submission to
generate. The difference between these two request methods is
discussed in Recipe 18.6; for now,
we’ll always use
Most of the form-based web scripts shown in this chapter share some common behaviors: