CGI GET vs. POST

Thomas Heller theller at python.net
Fri Apr 5 07:40:59 EST 2002


I'm trying to use the cgi module in a CGI script,
but encountered a problem.

My form looks like this:

<form method=...>
<input name=keyword>
<input type=submit>
</form>

and this is part of the Python code in the script:

form = cgi.FieldStorage()
if form.has_key("keyword"):
    keyword = form["keyword"].value
    ... and so on.

If I use method=POST in the CGI-script, the
"keyword" is found as a field in FieldStorage,
but NOT if I use method=GET.
Is FieldStorage only usable with POST?

Thanks,

Thomas





More information about the Python-list mailing list