Saving Multiple Row Values Into A Single Table In Database, Is It Possible?

I have a table named ‘account_details’ and in my view page I have this rows who asks for the reference no., amount, penalty and checker. What I want is whenever the user enters input for the following rows it will be saved in ‘account_details’ table. Those information should only belong to one id. Example, User_id = 1, ref.no = 1, amount = 100, penalty = 0, checker = john. | User_id = 2, ref.no = 2, amount = 200, penalty = 0, checker = jane. Also how can I accessed it from database to my view page?

Or is there any suggestions how can i do it correctly?

It seems like you’re talking about tabular input; check the Guide and also this extension.

You are correct. Sorry.




<tr>

				<td>Mayor's Permit Fee</td>

				<td>

				<?php 

				if(Yii::app()->user->role == 'ASSESSOR')

					echo $form->textField($model,'reference', array('size'=>13,'maxlength'=>50, 'disabled'=> false)); 

				else 

					echo $form->textField($model,'reference', array('size'=>13,'maxlength'=>50, 'disabled'=> true));			

				?>

				</td>

				<td>

				<?php 

				if(Yii::app()->user->role == 'ASSESSOR')

					echo $form->textField($model,'amount', array('size'=>13,'maxlength'=>50, 'disabled'=> false)); 

				else 

					echo $form->textField($model,'amount', array('size'=>13,'maxlength'=>50, 'disabled'=> true));			

				?>

				</td>

				<td>

				<?php 

				if(Yii::app()->user->role == 'ASSESSOR')

					echo $form->textField($model,'penalty', array('size'=>13,'maxlength'=>50, 'disabled'=> false)); 

				else 

					echo $form->textField($model,'penalty', array('size'=>13,'maxlength'=>50, 'disabled'=> true));			

				?>

				</td>

				<td>

				<?php 

				if(Yii::app()->user->role == 'ASSESSOR')

					echo $form->textField($model,'checker', array('size'=>13,'maxlength'=>50, 'disabled'=> false)); 

				else 

					echo $form->textField($model,'checker', array('size'=>13,'maxlength'=>50, 'disabled'=> true));			

				?>

				</td>


			</tr>



I want to save those input values to same user_id in table ‘account_details’. Am I doing the right thing?

It’s late on a Sunday evening so my brain is disengaged to understand your code; sorry. Try the MultiModelFom extension referred to above. Let’s try again tomorrow. :slight_smile:

Okay :slight_smile: Sleepwell :)