Is tough to guess what exactly your application is doing by looking at a little bit of code. I would recommend the following just based on what posted here.
1. Add a hidden field
<input type="hidden" id="btnClickedValue" name="btnClickedValue" value="" />
2. Store the button inner text into a hidden field each time the button clicked
document.getElementById("btnClickedValue").value = buttontext;
3. Then, on the backend / php side, you can write something like below to get the button innerText
Again, this is just based on what posted here.