How do I set names for each radio button in the following PHP code using counter variable, or any other alternative?
<?php
$id=0; //counter variable
$sql ="select roll_number,student_name,gender from student_table";
$query=mysqli_query($dbcon, $sql) or die(mysqli_error($dbcon));
while($post=mysqli_fetch_assoc($query)){
echo '<tr>';
echo '<td>'. $post['roll_number'] . '</td>';
echo '<td>'. $post['student_name'] . '</td>';
echo '<td>'. $post['gender'] . '</td>';
echo '<td width=250>';
echo '<input type="radio" name="rad'.$id'" value="P" />Present';
echo '<input type="radio" name="rad'.$id'" value="A" />Absent';
echo '<button type="submit" name="save" value="Save" class="btn btn-success btn-sm">Save</button>';
++$id;
echo '</td>';
echo '</tr>';
}
?>