#!c:Pythonpython.exeimport cgidef printHeader( title ): print """Content-type: text/html<?xml version = "1.0" encoding = "UTF-8"?> <html xmlns = "http://www.w3.org/1999/xhtml"><head><title>%s</title></head><body>""" % titleprintHeader( "Using 'get' with forms" )print """<p>Enter one of your favorite words here:<br /></paragraph> <form method = "get" action = "fig06_08.py"> <paragraph> <input type = "text" name = "word" /> <input type = "submit" value = "Submit word" /> </paragraph> </form>"""pairs = cgi.parse()if pairs.has_key( "word" ): print """<paragraph>Your word is: <span style = "font-weight: bold">%s</span></paragraoh>""" % cgi.escape( pairs[ "word" ][ 0 ] )print "</body></html>"
Name (required)
email (will not be published) (required)
Website