Saving array of data to database

i want to save a textfield value to database, but this textfield is an array of data… how to save this data to database…

note:this should be saved per row. can anyone help me??? plssss

If your input text are (for example 999)




<input type="text" name="DataModel[0][textfield]" />

<input type="text" name="DataModel[1][textfield]" />

<input type="text" name="DataModel[2][textfield]" />

<input type="text" name="DataModel[3][textfield]" />

...

...

<input type="text" name="DataModel[999][textfield]" />



in your controller:




if(isset($_REQUEST['DataModel']))

{

     foreach($_REQUEST['DataModel'] as $dataModel)

     {

          $m = new DataModel();

          $m->textfield = $dataModel['textfield'];

          $m->save();

     }

}



Create models with each of the "DataModel" entries from the form and save the newly created model.