Re: [Tutor] Python cgi doesn't get data from html form as expected
> Please post the HTML for the form you are submitting and the HTML from a > View Source on the result. > > Kent Sorry to have bothered the list. I figured out the answer (sort of). I had parse the HTML code through an XHTML parser which removed all the name= leaving id= only. That doesn't work with the cgi.FieldStorage function. I still don't know how to do it with XHTML which doesn't evidently support the name= at all. So, html it is. Thanks, Vicki ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Python cgi doesn't get data from html form as expected
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 "\n\n" import cgitb, os, sys cgitb.enable() sys.strerr = sys.stdout import cgi form = cgi.FieldStorage() field_list = '\n' for field in form.keys(): field_list = field_list + '%s\n' % field field_list = field_list + '\n' print field_list print "\n\n" Please post the HTML for the form you are submitting and the HTML from a View Source on the result. Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Python cgi doesn't get data from html form as expected
> 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. > > http://gnosis.cx/publish/programming/feature_5min_python.html > > 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: #! /usr/bin/python print "Content-Type: text/html\n\n" print print "\n\n" import cgitb, os, sys cgitb.enable() sys.strerr = sys.stdout import cgi form = cgi.FieldStorage() field_list = '\n' for field in form.keys(): field_list = field_list + '%s\n' % field field_list = field_list + '\n' print field_list print "\n\n" ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Python cgi doesn't get data from html form as expected
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. http://gnosis.cx/publish/programming/feature_5min_python.html Hope that helps. Best Regards, Michael Lasky On Tue, 2005-03-22 at 14:02 +, Vicki Stanfield wrote: > I have recently started doing cgi in Python and have run into a problem. I > have an html form which has various widgets which accept data. I also have > this in that html file: > > > > formdata.py runs but doesn't seem to contain the data from the form. I'm > not sure of the format for the for with regard to FieldStorage btw. Here > is the contents of formdata.py: > > > #! /usr/bin/python > import cgitb, os, sys > cgitb.enable() > > import cgi > > print "Content-Type: text/html\n\n" > print "" > form = cgi.FieldStorage() > for each in form: > print "each" > print form['fname'].value, form['lname'].value > #print "address:", form['addr'].value() > print "" > -- > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Python cgi doesn't get data from html form as expected
I have recently started doing cgi in Python and have run into a problem. I have an html form which has various widgets which accept data. I also have this in that html file: formdata.py runs but doesn't seem to contain the data from the form. I'm not sure of the format for the for with regard to FieldStorage btw. Here is the contents of formdata.py: #! /usr/bin/python import cgitb, os, sys cgitb.enable() import cgi print "Content-Type: text/html\n\n" print "" form = cgi.FieldStorage() for each in form: print "each" print form['fname'].value, form['lname'].value #print "address:", form['addr'].value() print "" -- ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor