[Tutor] CGI and other stuff
Mon, 13 Nov 2000 20:10:17 -0700
* D-Man <firstname.lastname@example.org>:
> I'm trying to write a couple of cgi scripts to dynamically create some web
> pages. I have finally figured out how to access the query string. Now I
> would like some suggestions as to the best way to parse it. The parsing
> method as well as the format of the string is completely at my discretion.
If I understand you correctly, something like this is what you want:
form = cgi.FieldStorage()
Then you can use form as you would a dictionary with key/value pairs:
if form["edit"].value == "add":
elif form["edit"].value == "delete":
http://url/script?edit=add would then cause the function add_node() to run.