Processing Parameters Passed to CGI Scripts : Introduction : CGI Web PYTHON TUTORIALS


PYTHON TUTORIALS » CGI Web » Introduction »

 

Processing Parameters Passed to CGI Scripts


#!/usr/bin/pythonimport cgi, sys

#Send errors to browser
sys.stderr = sys.stdout

#Parse data from form
data = cgi.FieldStorage()

#Send response to browser
print "Content-type: text/htmln"
print "<title>CGI Form Response</title>n"
print "<h2>Current Quote</h2><P>"

if data.has_key('name') and data.has_key('quote'):
    print "<B>%s</B>: %s" (data['name'].value, 
          data['quote'].value)



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo CGI Web
» Introduction