I retrieve data from databased based on 4 dropdown criteria.Display them on a table and add one column for scores of each student. I want to populate another table with all the
I have found an answer to the question: Just declare the name field as an array and insert them into the DB using foreach loop.
while($fetch=mysqli_fetch_array($confirm)){
$c++;
echo "";
echo "".$c." ";
echo" ";
echo" ";
echo" ";
echo" ";
echo" ";
echo" ";
echo "";
echo " ";
echo " ";
}
//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);
}
}