php - How to determine which checkbox is checked? -


i have html table of 4 columns: studentid, first_name, last_name , 5 checkboxes grades. how can determine in php (or maybe using jquery?) check box(grade) checked each studentid?

<tr>     <td>         <?php print $stud_row['student_id']; ?>     </td>     <td>         <?php print $stud_row['first_name']; ?>     </td>     <td>         <?php print $stud_row['last_name']; ?>     </td>     <td>         <input type="checkbox" name="id" value="a">          <input type="checkbox" name="id" value="b"> b          <input type="checkbox" name="id" value="c"> c          <input type="checkbox" name="id" value="d"> d          <input type="checkbox" name="id" value="f"> f     </td> </tr> 

here functional example on how see grade selected using jquery:

<!doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script> $(function() {     $('.grade').on('change',function(){         if($(this).is(':checked')){             $('#grades').append($(this).val());         }else{             $('#grades').html($('#grades').html().replace($(this).val(),''));         }     }); }); </script> </head> <body> <input class="grade" type="checkbox" name="a" value="a"> <br> <input class="grade" type="checkbox" name="b" value="b"> b <br> <input class="grade" type="checkbox" name="c" value="c"> c <br> <input class="grade" type="checkbox" name="d" value="d"> d <br> <input class="grade" type="checkbox" name="f" value="f"> f <br> <div id="grades"></div> </body> </html>  

then if need see on server use ajax or form pass back.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -