views:

39

answers:

1

I have one <form id="inputdefect">,and one <input id="item">, but inside that I have two submit buttons: <button id="accept"> and <button id="reject">

They have same purpose, but different result in the DB. This is the result:

item                       condition
tape                       accept
roll                       reject

I want if button "accept" is clicked the result at DB is accept. but if button "reject" is clicked the result is reject. i have tried to combine both command, but i still confuse to manage command at process page.

$("#accept, #reject").click(function(event) {
        if($("#accept, #reject").valid()) {
                $.ajax({
                        type: "post",
                        url: "process1.php",
                        data: "status="+str+"&action=stat",
                        cache: false,
                        async: false,
                        success: function() {
                                  $(".defect").removeAttr("checked");
                                  $("#dialog").dialog("close");
                                  return this;
                        },
                        error: function() {
                                  alert("Data failed to input.");
                        }
                });
                 return false;
        }
});
A: 

You could add a bit into the code you posted that sets a hidden input to "accept" or "reject" depending on which one they clicked.

Shane Reustle