How To Save The Same Model Multiple Times

Here i am saving the same model multiple times depending upon the user . I kept two fields one is title and text

and if user click add button then another two fields will added and soon but while i am saving these models in the controller i able to save the last fields only

my controller is

if (isset($_POST[‘Task’]))



		foreach($_POST['Task'] as $i => $item)


			$model->attributes = $_POST['Task'][$i];






and while print the array using print_r() it is getting all the fields value ex

Array ( [title] => title1 [id] => [text] => ) Array ( [title] => title1 [text] => text1 [id] => ) Array ( [title] => title4 [text] => text1 [id] => ) Array ( [title] => title4 [text] => text4 [id] => )

can anyone help me in saving all these values

This two links might be useful…

Wiki article

Guide topic