Saya telah menemukan jawaban untuk pertanyaan:Cukup nyatakan bidang nama sebagai array dan masukkan ke dalam DB menggunakan loop foreach.
while($fetch=mysqli_fetch_array($confirm)){
$c++;
echo "<tr>";
echo "<td>".$c."</td>";
echo"<td><input type='text' name='admNo[]' value='".$fetch["AdmNo"]."'></td>";
echo"<td><input type='text' name='sname[]' value='".$fetch["Surname"]."'></td>";
echo"<td><input type='text' name='fname[]' value='".$fetch["Firstname"]."'></td>";
echo"<td><input type='text' name='class[]' value='".$fetch["class"]."'></td>";
echo"<td><input type='text' name='SessionAssigned[]' value='".$fetch["CSession"]."'></td>";
echo"<td><input type='text' name='Term[]' value='".$fetch["Term"]."'></td>";
echo "<td><input type='text' name='sub[]' value='".$sub."'</td>";
echo "<td><input type='text' name='score[]'></td>";
echo "</tr>";
}
//if score is supplied , then click to save to database
}
if(isset($_POST["saveBtn"])){
foreach($_POST["admNo"] as $rec=> $value){
$cl = $_POST["class"][$rec];
$term = $_POST["Term"][$rec];
$ad = $_POST["admNo"][$rec];
$Csess = $_POST["SessionAssigned"][$rec];
$sub = $_POST["sub"][$rec];
$sc = $_POST["score"][$rec];
$insert = "INSERT INTO result_tab(CSession,Term,Class,AdmNo,subject,score)VALUES('$Csess','$term',
'$cl','$ad','$sub','$sc')";
$succ = mysqli_query($connection,$insert);
}
}