I have this code but I can't pass the value of array variable $component which has the input data of string. What should I do?
<?php if(isset($_POST['submit_tbl_grade'])){
$id = isset($_POST['id']) ? $_POST['id'] : array();
$component = $_POST['component'];
$sub_component_number = $_POST['sub_component_number'];
$subject = $_POST['subject'];
$score = $_POST['score'];
for($i = 0 ; $i < count($id) ; $i++){
$record = "INSERT INTO tbl_grade(stud_id,subject_id,component,sub_component_number,component_value) VALUES ($id[$i],$subject[$i],$component[$i],$sub_component_number[$i],$score[$i])";
mysqli_query($db,$record);
}
} ?>