In your buttons, you can simply set the form action using the form property , for example, on the a button:
this.form.action = "fileA.php";
On the other hand:
this.form.action = "fileB.php";
You can install this outside, for example:
document.getElementById("buttonA").onclick = function() { document.getElementById("myForm").action = "fileA.php"; };
Or if you are using jQuery library:
$(function() { $("#buttonA").click(function() { $(this).closest("form").attr('action', 'fileA.php'); }); });
Nick craver
source share