2002-10-16 18:01:27 -03:00
|
|
|
#!/usr/local/bin/python
|
|
|
|
|
|
|
|
"""CGI test 2 - basic use of cgi module."""
|
|
|
|
|
|
|
|
import cgitb; cgitb.enable()
|
|
|
|
|
|
|
|
import cgi
|
|
|
|
|
|
|
|
def main():
|
|
|
|
form = cgi.FieldStorage()
|
2007-07-17 17:59:35 -03:00
|
|
|
print("Content-type: text/html")
|
|
|
|
print()
|
2002-10-16 18:01:27 -03:00
|
|
|
if not form:
|
2007-07-17 17:59:35 -03:00
|
|
|
print("<h1>No Form Keys</h1>")
|
2002-10-16 18:01:27 -03:00
|
|
|
else:
|
2007-07-17 17:59:35 -03:00
|
|
|
print("<h1>Form Keys</h1>")
|
2007-08-06 18:07:53 -03:00
|
|
|
for key in form.keys():
|
2002-10-16 18:01:27 -03:00
|
|
|
value = form[key].value
|
2007-07-17 17:59:35 -03:00
|
|
|
print("<p>", cgi.escape(key), ":", cgi.escape(value))
|
2002-10-16 18:01:27 -03:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|