Handling multiple buttons(displayed dynamicaaly based on condtion)

hi,i need help on handling multiple submit buttons.
based on condition i am displaying multiple buttons which updates the records of each employee(individual button to each record displayed).so that i can update select records based on my choicebut i am not able jandle the multiple buttons,because the number of buttons will change dynamically .
please suggest me the possible solutions!
thanking you in advance.

I’m not 100% sure what you’re asking, but it sounds like you want to know how to use multiple submit buttons within the same form. I would use JavaScript (jQuery specifically) and do something like this:

<script type="text/javascript">
$(function() {
   $('input#submit1').click( function() {
      alert('button 1 clicked');
      return false;

   $('input#submit2').click( function() {
      alert('button 2 clicked');
      return false;

   $('input#submit3').click( function() {
      alert('button 3 clicked');
      return false;

   <input type="submit" name="submit1" id="submit1" value="Submit 1" />
   <input type="submit" name="submit2" id="submit2" value="Submit 2" />
   <input type="submit" name="submit3" id="submit3" value="Submit 3" />

Of course, instead of alerting you could post the form to whatever url you want via ajax. See documentation here: http://api.jquery.com/jQuery.ajax/

thank u for the reply.
i will explain you what the problem is.in my project,i need to approve the employees leave requests.so i am fetching the data from my db asselect * from db where reqstatus=pending.
based on the status colomn of my table the records will be displayed like this
empid leavefrom(date) leaveto(date) status
1 20012-3-16 2012-3-18(can be changed) pending(drop down) [approvebuttonhere

i am also adding the button tp approve the leave.so that admin can approve the leave.now my problem is,the number of records may depend on the employees leave needs,
so the number of buttons will change dynamicaaly.
all those buttons are in a single page.
i want to send the id,from date,todate status=approved value to be updated on the database based on the id of a employee.problem is when i click a button.i confused,how to show difference among the buttons,to send the single record to db for a single button…
please help me !