My application displays student details and their attendance to teacher via table. Teacher can increase/decrease the student attendance with help of button present along side in seperate column. Below is the code
    <table align="center">
  <tr>
    <th>Program</th>
    <th>Branch</th>
    <th>Semester</th>
    <th>Roll No.</th>
    <th>Attendance</th>
    <th>Increase</th>
  </tr>
<?php
$tId=$_SESSION['idf'];
  $result = mysqli_query($con,"SELECT attendance.program, attendance.branch, attendance.semester, attendance.rollno, attendance.attendno from attendance, login_student WHERE login_student.rollno = attendance.rollno AND login_student.branch = attendance.branch AND login_student.program = attendance.program AND login_student.semester = attendance.semester AND attendance.tid='$tId' ORDER BY login_student.branch") or die('Error');
  function increase($roll,$att) {
        $one=1;
        $newatt=$att+$one;
        $q=mysqli_query($con,"UPDATE attendance SET attendno='$newatt' WHERE attendance.rollno='$roll' AND attendance.tid='$tId'") or die('Error');
  }
while($row = mysqli_fetch_array($result)) {
$program = $row['program'];
$branch = $row['branch'];
$semester = $row['semester'];
$roll = $row['rollno'];
$att = $row['attendno'];
echo '<tr><td>'.$program.'</td><td>'.$branch.'</td><td>'.$semester.'</td><td>'.$roll.'</td><td>'.$att.'</td><td><button onclick="increase('.$roll.','.$att.')">+</button></td></tr>';
}
echo '</table></div>';
?>
</table>
For now I am working on increase button which is dislayed in table but doesnot work when clicked. The increase function is not been called when button is clicked. Any help will be appreciated!
 
    