Home > other >  how to insert into database with multiple array in php
how to insert into database with multiple array in php

Time:02-10

hi guys can someone help me how to this. I have here the problems I can't solve it for example

data for manny

 <input type="text" name="name[]" value="Manny" >

 <input type="text" name="course[]" value="BSIT" >
 <input type="text" name="level[]" value="2nd year" >

 <input type="text" name="course[]" value="BSCS" >
 <input type="text" name="level[]" value="3rd year" >

 <input type="text" name="course[]" value="BSENG" >
 <input type="text" name="level[]" value="4th year" >

data for Floyd

 <input type="text" name="name[]" value="Floyd" >

 <input type="text" name="course[]" value="ABM" >
 <input type="text" name="level[]" value="Grade 11" >

 <input type="text" name="course[]" value="STEM" >
 <input type="text" name="level[]" value="Grade 12" >

Manny hold 3 classes while Floyd hold 2 classes. so how can I insert it into database I guess use an array is suit for this problem but I don't know how. please help me with this

CodePudding user response:

I think it will make more sense to use an array if the structure "data for Manny" and "data for Floyd" are the same. Not like when you are having "GRADE" in "data for Floyd" and "YEAR" in "data for Manny".

Moreover, what exactly are you trying to achieve? You don't want to treat Manny and Floyd data separately?

  •  Tags:  
  • Related