title: How to Add +1 to attendance value in the Mysql database if Radio button(present) is selected with PHP?
body: <p>Excuse me, I want to make an attendance form at my college using PHP and MySql for the database.</p>
  
  <p>The database table :</p>
  
  <pre><code> student_id      student_name         Class     Attendance
   001             Adam                 1-B3      0
   002             Martin               1-B3      0
   003             Nina                 4-C1      0
  </code></pre>
  
  <p>Attendance Form (attend.php) will show :</p>
  
  <pre><code> ID      Name         Attendance
   001     Adam         (radio) Present  (radio) Not Present
   002     Martin       (radio) Present  (radio) Not Present
   003     Nina         (radio) Present  (radio) Not Present
  </code></pre>
  
  <p>Assuming there are 1000 students, I use SQL query to show each person in the table with 2 radio button in each row based on the class needed.
  Example :</p>
  
  <pre><code>&lt;form method="POST" action="attend_process.php")
  $cn=mysql_connect("host","localhost","") or die(mysql_error());
  mysql_select_db(db_attendance,$cn) or die(mysql_error());
  $sql = "SELECT student_id, student_name FROM tb_attendance WHERE Class='1-B3'";
  $result = mysql_query($sql) or die(mysql_error());
  
  echo "&lt;table&gt;";
  echo "&lt;tr&gt;&lt;th&gt;ID&lt;/th&gt;&lt;th&gt;Name&lt;/th&gt;&lt;th&gt;Attendance&lt;/th&gt;&lt;/tr&gt;";
  
  while($info=mysql_fetch_array($result)){
  $id = $info['student_id'];
  $name = $info['student_name'];
      echo "&lt;tr&gt;&lt;td&gt;".$id."&lt;/td&gt;&lt;td&gt;".$name."&lt;/td&gt;&lt;td&gt;&lt;input type='radio' name='attend[$id]' value='Present'&gt;Present &amp;nbsp; &lt;input type='radio' name='attend[$id]' value='Not_Present'&gt;Not Present&lt;/td&gt;&lt;/tr&gt;";
  }
  echo "&lt;/table&gt;&lt;br/&gt;
  echo "&lt;input type='submit' name='btnAbsent' value='Absent'&gt;";
  &lt;/form&gt;
  </code></pre>
  
  <p>The form that I'm supposed to make, after I clicked on the submit button on attend.php
  it will POST the data to attend_process.php.</p>
  
  <p>In attend_process.php, 
  ???How to add the value in Attendance value in the database???
  ???How to make a variable with $_POST['attend$id'] to get the value 'Present'???</p>
  
  <p>It based on their class either, 
  1. if some student not present, then the attendance not increasing.
  2. if the student is present, the attendance value will increase by 1 (+1)</p>
  
  <p>I'm really sorry, but I'm really confused how to get the data and then add the value to the attendance value correctly base on their ID, because the radio buttons in each row have different name made by their 'ID'. Thank you in advance. I really appreciate your kindness :)</p>