Input with POST method

This pages shows how to obtain and parse user input from the POST method.

Programming Issues

Most of the code is identical to the GET method example. The only differences are:

Usage

You can only use the POST method from a form, such as the one below:

Type your favourite word:
Choose a fruit:
Which is best?

Choose all the languages you know:


Type something interesting:

Note that we end up with multiple values in the "langsknown" variable because we have used the same name attribute for each of the check boxes. In the CGI script, we have used "---" as the multiple separator, but in practice we would probably use \0 in case the user actually entered "---". Using \0 also allows us to treat langsknown as a Perl list if we want to do that.

Source and Downloads