I want to enter an multiple field entered data in table with for loop
but I am getting an error in the post method.
The error is:
Use of undefined constant i – assumed ‘i’ (this will throw an Error in a future version of PHP)
controller code:
$degree = $request->degree;
if($degree > 0)
{
for($i=0;$i<count($degree);$i++){
$edu = new education;
$edu->degree = $request->degree[i];
$edu->clg = $request->clg[i];
$edu->yoc = $request->yoc[i];
$edu->save();
}
}
so, please suggest me what I can do.
>Solution :
here there is a silly mistake bro you not remember to use $i inside loop for the degree, clg and yoc