[Tutor] Python cgi doesn't get data from html form as expected
vicki at stanfield.net
Tue Mar 22 16:33:40 CET 2005
> I haven't done too much web stuff (or much of anything) with python, but
> I looked into your question a bit (researching other's problems may help
> me avoid them =)). A quick search brought up this page which seems to
> have information which may help you.
> Hope that helps.
> Best Regards,
> Michael Lasky
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:
print "Content-Type: text/html\n\n"
import cgitb, os, sys
sys.strerr = sys.stdout
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'
More information about the Tutor