Oct 3, 2002 #1 linmac Technical User Joined Aug 21, 2002 Messages 7 Location MY please anybody tell me, how to read parameter form cgi files like below: http://host/cgi-bin/print?a=1 and how to process them in function I just need example. thanx in andvance
please anybody tell me, how to read parameter form cgi files like below: http://host/cgi-bin/print?a=1 and how to process them in function I just need example. thanx in andvance
Dec 3, 2002 #2 nigelcohen Programmer Joined May 10, 2002 Messages 14 Location GB 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 Upvote 0 Downvote
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