How to identify which submit button was clicked: SOLVED

How to identify which submit button was clicked: SOLVED

Hi

I am tearing my hair out over this.

I am in the process of 'ajaxifying' a form which has four different submit buttons, each of which has a different value and triggers a different set of logic on the controlling script which receives the form's input. This was fine when I was simply using straight php as I can simply write:

if ($_POST[submit] == "blah") {

//do stuff

}


However I now see that the one element of the $_POST array the JQuery form plug-in doesn't include is the value of the submit button. So what I need to do is identify which of the 4 buttons was clicked then append that data to the POST.

Here is the bit of code in question:

$(document).ready(function(){
   
   $(".check").append("&nbsp;<input type=\"button\" class=\"input-submit\" name=\"check\" value=\"Select all\" />");
   $("input").focus(function() { $(this).css({backgroundColor: " #f5eab6"})});
   $("input").blur(function() { $(this).css({backgroundColor: " #fff"})});
   $("input[name='check']").click(function() {
      $("input[@name^='_cx']").attr("checked", "checked");});   
   
   var options = {
        url:"masterform_process.php?token=<?php echo "$token"; ?>&ajax=1",
        dataType: 'json',
      success: handler
       
    };
          
    $('#master2').livequery('submit', function() {
       
    $(this).ajaxSubmit(options);

        return false;
    })});


Now I guess that this involves getting the index of the submit button clicked and adding that to the POST array (or to the GET querystring would be fine too) but I am stumped as to (a) where and how to identify the index and (b) how to then add it to the data before the ajax query is sent.

I'm not asking for someone to write my code, but if anyone knows of a tutorial or similar which would cover it, I'd be incredibly grateful.

Thanks