hi this is my forloop which has bulk number of data
$a = 1;
for($i = 0; $i < sizeof($StudName); $i++) { ?>
<tr align="left">
<td class="table_label"><? echo $code[$i].' - '.$StudName[$i]; ?></td>
<td><input type="text" name="mark1<?= $a ?>" id="mark1<?= $a ?>" ></td>
<td><input type="text" name="mark2<?= $a ?>" id="mark2<?= $a ?>" ></td>
<td><input type="text" name="mark3<?= $a ?>" id="mark3<?= $a ?>" onkeyup="return percent('mark1<?= $a ?>','mark2<?= $a ?>','mark3<?= $a ?>','total<?= $a ?>','Average<?= $a ?>')" ></td>
<td><input type="text" name="total<?= $a ?>" id="total<?= $a ?>" onkeyup="return percent('mark1<?= $a ?>','mark2<?= $a ?>','mark3<?= $a ?>','total<?= $a ?>','Average<?= $a ?>')"></td>
<td><input type = "text" name="Average<?= $a ?>" id="Average<?= $a ?>" ></td>
</tr>
<? $a++; } ?>
I received the values like this:
function Addmark() {
echo "ssssssssssss";
for($a = 1; $a <= $rowcount; $a++) {
$markI = 'mark1'.$a;
$markII = 'mark2'.$a;
$markIII = 'mark3'.$a;
$total = 'total'.$a;
$avg = 'Average'.$a;
echo $mI[] = $this->input->post($mark1);
$mII[] = $this->input->post($mark2);
$mIII[] = $this->input->post($mark3);
$Total[] = $this->input->post($total);
$Avrg[] = $this->input->post($Average);
}
$res = $this->staffModel->Addmark($mI, $mII, $mIII, $Total, $Avrg);
if($res == true) {
$this->session->set_flashdata('response', 'data added successfully !');
} else {
$this->session->set_flashdata('response', 'data already exist !');
}
$this->load->view('Sstudentlist',$data);
}
is this the correct syntax