Hi there. I am having a bit of a play with teh cgi module, trying to figure out how to process a web form.
I have come a little ways from reading up variou sexamples and tutes that I've found on the net, but they all leave me with a couple of questions: My code below has an attempt at validation that doesn't seem to do anything. I am expecting that it will report an error if all the fields haven't been filled in. Instead, it seems to just ignore an empty field and carry on. The second for loop is an attempt at trying to print all the values that were entered on the for without presenting the hidden values. I'd really like to do this, but I can't seem to figure out how to make a special case for hidden form values, nor can I find an example of how to do it in any of the many python cgi pages I've visited so far. If I removed the "if not type=hidden" and fix the indentation this works pretty much as I expect. TIA Googleboy print 'Content-type: text/html\n\n' print htmlheader for key in form.keys(): if not form.has_key(key): print "<h1> ERROR! <h1><BR>" print "Please go back and fill in all fields. All fields are required.<br>" break print "You entered the following:<br> " for key in form.keys(): if not type="hidden": print form[key].value + '<br><br>' print '<br>' + timestamp print '<br><br>' print '</body></html>' -- http://mail.python.org/mailman/listinfo/python-list