What I want is to be able to make my CGI script do different things depending on what action initiated the calling of the script.
For example, if one button is pressed, a database is cleared. If another button is pressed, a form is submitted and that data is added to the database.
Should I be doing something like adding the name of the form/button to the end of the POST
data submitted in jQuery and then .pop
ing it off in the script?
Or is there some other data that's already sent in the POST
that I could get from FieldStorage
that would give me the information I need to decide what the script should do when it's called?
And what if I wasn't using javascript? Would I have to have a hidden field that gets submitted with the name of the form/button?
Or is it best to use a different target script for each button on a page?