[Tutor] Python cgi doesn't get data from html form as expected
Kent Johnson
kent37 at tds.net
Tue Mar 22 16:58:55 CET 2005
Vicki Stanfield wrote:
> I don't see anything in that page that changes what I am doing. I can get
> rid of everything that has to do with retrieving data from
> cgi-FieldStorage, and the code executes fine although I get a blank page.
> I have revised the code somewhat, but the initial problem of
> cgi.FieldStorage being empty is still there. I don't get an error now,
> just an empty page. Here is the revised code:
>
> #! /usr/bin/python
> print "Content-Type: text/html\n\n"
> print
> print "<html><head></head><body>\n\n"
>
> import cgitb, os, sys
> cgitb.enable()
> sys.strerr = sys.stdout
>
> import cgi
>
> form = cgi.FieldStorage()
> field_list = '<ul>\n'
> for field in form.keys():
> field_list = field_list + '<li>%s</li>\n' % field
> field_list = field_list + '</ul>\n'
> print field_list
> print "</body></html>\n\n"
Please post the HTML for the form you are submitting and the HTML from a View Source on the result.
Kent
More information about the Tutor
mailing list