Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cgi parameter

Status
Not open for further replies.

linmac

Technical User
Aug 21, 2002
7
MY
please anybody tell me, how to read parameter form cgi files like below:


and how to process them in function
I just need example. thanx in andvance
 
Try this:

************************
import cgi
import os

RegisterForm = cgi.FieldStorage(keep_blank_values=1)
if os.environ.has_key('PATH_INFO'):
PathInfo = os.environ['PATH_INFO']

# This routine finds out if you have selected
# the "print" path
if PathInfo == '/print':
print "This is a print routine"

# This routine shows you how to access the parameters
for item in RegisterForm:
print item, RegisterForm[item].value


There is much more to cgi than just this. It helps if you look through the cgi.py and os.py files to see how they handle calls.

Good luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top