#!C:\Python33\python.exe import cgi form = cgi.FieldStorage() # instantiate only once! name = form.getfirst('name', 'empty') # Avoid script injection escaping the user input name = cgi.escape(name) print ("""\ Content-Type: text/html\n
The submitted name was "%s"
""" % name)