Created
November 8, 2015 01:31
-
-
Save Teino1978-Corp/cc4243090130f12a9164 to your computer and use it in GitHub Desktop.
Python cgi: My attemp to convert from 2.7 to 3.4.1: Source-https://wiki.python.org/moin/CgiScripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mport cgi | |
| import cgitb; cgitb.enable() | |
| print("Content-type: text/html") | |
| print() | |
| print""" | |
| <html> | |
| <head><title>Sample CGI Script</title></head> | |
| <body> | |
| <h3>Testing stuff</h3> | |
| """ | |
| form = cgi.FieldStorage() | |
| message = form.getvalue("message", "(no message)") | |
| print""" | |
| <p>Previous message: %s</p> | |
| <p>form | |
| <form method="post" action="index.cgi"> | |
| <p>message: <input type="text" name="message"/></p> | |
| </form> | |
| </p> #I added this to close the form <p> Code failed without and with it. | |
| </body> | |
| </html> | |
| """ % cgi.escape(message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment