How To Populate Form With Results From Db

Hi all,

I’m trying to let the users of my app to create their own forms.

For this I created 3 table

User

id

name

Element

id

type [0=‘textfield’,1=‘textArea’,2=‘radio’]

label

Value (only for multiple choici like radio)

id

value

elementId

then I have an other table to retriever the result from the personalized form

Result

id

elementId

value

My question is, how can I see the result now on the new freshly created form and filled ?

Here some code




switch ($element->typeId) {

            case 0:

                echo CHtml::textField("Result[elementid][$element->id]",array('value'=> <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' /> HERE MAYBE I NEED TO SEARCH FOR MY RESULT));

                break;

            case 1:

                echo CHtml::textArea("Result[elementid][$element->id]",array('value'=> <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' /> HERE MAYBE I NEED TO SEARCH FOR MY RESULT));

                break;

            case 2:

                echo CHtml::radioButtonList("Result[elementid][$element->id]",'',CHtml::listData($element->values,'id','value',array('value'=> <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' /> HERE MAYBE I NEED TO SEARCH FOR MY RESULT));

                break;

            case 3:

                echo CHtml::checkBoxList("Result[elementid][$element->id]",'',CHtml::listData($element->values,'id','value',array('value'=> <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' /> HERE MAYBE I NEED TO SEARCH FOR MY RESULT));

                break;

            case 4:

                echo CHtml::dropDownList("Result[elementid][$element->id]",'',CHtml::listData($element->values,'id','value',array('value'=> <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' /> HERE MAYBE I NEED TO SEARCH FOR MY RESULT));

                break;

        }

        ?>




Thanks for help