Implementing dynamic fields


I have something difficult to implement. I have a basic form for firm data, but I have to dynamically create tabs for departments. For each department I have say the following data: TITLE, MANAGER, DESCRIPTION.

When having registration, this is not very important, because I limit to 4 departments. But, when the user logs and we approve him for VIP account and if he is VIP, he will have access to 10 tabs for departments.

Which is the best approach to create such tabs with dynamic data. I am not feeling good when I must create 100 variables with this layout $DEPARTMENT_1_TITLE and so on… :)

Any ideas?

Are these tables contain the same form?

Check http://www.yiiframew…uide/form.table

Yes, I think this is the approach, will try it and provide feedback.

Hello i just tried this method and unfortunately i get an error that the variable i am assigning is not an object and i was wondering if you could throw some light on the problem.

this is the form i am using:

<div class="simple">




<td><?php echo CHtml::activeTextField($subfirms,"FIRM_NAME[0]"); ?></td>



<td><?php echo CHtml::activeTextField($subfirms,"FIRM_NAME[1]"); ?></td>




and this is the part of the controller i am concerned about(it's in actionCreate):

 $subfirms->attributes = $_POST['subfirms'];


		        foreach($subfirms as $i=>$subfirm)






thanks for your help!