Hi,
I know PHP. I dont know javascript and IM having a heck of a time getting something to work.
I know what the issue is. I dont know how to fix it.

I have a table with students that registered to attend a training.
On each row there are three form buttons. One says ABSENT, one says FAILED, the other says PASSED.
This table will display up to 25 rows at a time.

I want the instructor to press one of the buttons for each student and not refresh the entire page. At the same time UPDATE the row in MySQL/PHP.
This part works and its done.
The issue I am having is that after the button is pressed, the button is supposed to dissapear and replace the button with text that says, ABSENT, FAILED, Or PAssed(text depending on what is clicked)

The problem is one the first row, all is fine. Instructor presses ABSENT BUTTON, button refreshes to display ABSENT, (NO BUTTON). JUST TEXT.

Once I do the second row, it modifies the record properly in the db, however the button stays there and the text gets displayed on ROW 1. Not Row 2. SEE ATTACHED IMAGEinstructornetworkissue.png

As mentioned, the database gets updated fine. The only issue is the result is displaying on table row one becasue there is nothing telling it where to update.

Here is my code.

Javascript in header
Code:
 <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
  <script type="text/javascript" src="../instructor/includes/jscript/jquery.form.js"></script>
  <script type="text/javascript">
  $(document).ready(function() {
    $('#attendanceform').ajaxForm({
      target: '#showdata',
      success: function() {
        $('#showdata').fadeIn('slow');
      }
    });
  });
  </script>
Form Data
HTML Code:
    <form name="attendanceform" id="attendanceform" action="coursedetails_attendance_data.php" method="post">
          <input type="hidden" name="attendance" value="attended" />
          <input type="hidden" name="id" id="id" value="<?php echo $courseregid; ?>" />
		  <input type="submit" name="attendence" id="attended" class="btn success" value="Attended">
   		  <input type="submit" name="attendence" id="failed" class="btn error" value="Failed">
   		  <input type="submit" name="attendence" id="failed" class="btn error" value="Absent"><br />
          </form>
Here is page which updates the record

PHP Code:
<?php require_once('../../Connections/db.php'); ?>
<?php
if (!isset($_SESSION)) {
  
session_start();
}
?>
<?php
$attendance 
strtolower($_POST['attendence']);
    if (
$attendance == 'attended') {
     
$response =  '<span class="label success">ATTENDED</span>'; }
else if (
$attendance == 'failed') {
         
$response '<span class="label error">FAILED</span>'; }
else if (
$attendance == 'absent') {
         
$response =  '<span class="label warning">ABSENT</span>'; }

?>
<?php 
//update record
if (isset($_POST['attendance'])) {
    
mysql_select_db($database_db$db);
    
$result sprintf('UPDATE courseregistrations SET registrationstatus="'.$attendance.'" WHERE courseregistrationsid = '.(int)$_POST['id'],$link);
    
$Result1 mysql_query($result$db) or die(mysql_error());
    echo 
$response;
}
?>
Any help is appreciated!!