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