title: Python CGI Script: Basic HTML Form With Two Submit Buttons
body: <p>I have a basic html form which I want to use with two submit buttons.  The CGI script takes the form value and processes it (regardless of which submit button used), but I want each button to be associated with different actions later in the script, i.e. print different output:</p>
  
  <pre><code>##  Get the form value in the usual way.
  form = cgi.FieldStorage()
  RawSearchTerm = form.getvalue("QUERY")
  
  ##  Process the form info etc.
  
  if (button1 was pressed):
      print this
  elif (button2 was pressed):
      print this other thing
  </code></pre>
  
  <p>Any ideas appreciated, thanks.</p>