Skip to content

Instantly share code, notes, and snippets.

@stnc
Created November 16, 2016 10:36
Show Gist options
  • Save stnc/3d1b0712ca8615c4125f8b6ce061c66a to your computer and use it in GitHub Desktop.
Save stnc/3d1b0712ca8615c4125f8b6ce061c66a to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
#test için http://localhost:8000/cgi-bin/get_example.py?first_name=selman&last_name=tunc
# Import modules for CGI handling
import cgi, cgitb
# Create instance of FieldStorage
form = cgi.FieldStorage()
# Get data from fields
first_name = form.getvalue('first_name')
last_name = form.getvalue('last_name')
print ("Content-type:text/html")
print()
print ("<html>")
print ("<head>")
print ("<title>Hello - Second CGI Program</title>")
print ("</head>")
print ("<body>")
print ("<h2>Hello %s %s</h2>" % (first_name, last_name))
print ("</body>")
print ("</html>")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment