Finding out event that called a CGI script

Posted by Acorn on Stack Overflow See other posts from Stack Overflow or by Acorn
Published on 2010-05-19T11:02:39Z Indexed on 2010/06/15 16:32 UTC
Read the original article Hit count: 192

Filed under:
|
|
|
|

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 .poping 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?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about python