index.php
<form id="myForm" action="test2.php" method="POST">
    <input type="submit" value="Print 1" name="submit" id="submit">
    <input type="submit" value="Print 2" name="submit2" id="submit2">
</form> 
<div id="ack"></div>
here's my script
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript" src="scripts/login_script.js"></script>
test2.php
<?php
if(isset($_POST['submit'])){ 
echo "1"; // i want to show this everytime i click submit (not working)
}          // or what is the proper way to do this..
if(isset($_POST['submit2'])){
echo "2"; // i want to show this everytime i click submit2 (not working)
}         // or what is the proper way to do this..
?>
login_script.js
$("#submit, #submit2").click( function() {
  $.post( $("#myForm").attr("action"),
         $("#myForm :input").serializeArray(),
         function(data) {
                $("#ack").empty();
                $("#ack").html(data);
    });
$("#myForm").submit( function() {
   return false;    
});
});
if i remove the if(isset($_POST['submit'])).... its working... so what is the proper way to do this..? sorry im noob in ajax and jquery
 
     
     
    