#!c:\Python\python.exe
import os
import cgi
def printHeader( title ):
print """Content-type: text/html
%s
""" % title
printHeader( "QUERY_STRING example" )
print "Name/Value Pairs
"
query = os.environ[ "QUERY_STRING" ]
if len( query ) == 0:
print """
Please add some name-value pairs to the URL above.
Or try
this.
"""
else:
print """
The query string is '%s'. """ % cgi.escape( query )
pairs = cgi.parse_qs( query )
for key, value in pairs.items():
print "You set '%s' to value %s " % \
( key, value )
print ""