selected value of dropdownlist should be used for comparison

hi all,

    I have 2 table called Codes and expense

Codes table contain expense_codes and expense_name of that particular code.

Expense table contain (id,expene_name, expensecode,…)

Now in the Expense tables _form.php ,if i select the expense_name from the dropdownlist then the corresponding expense_code must be displayed as a non-editable field and must go into the Expense table.

Please help me .

Simply don’t save the expense code in the table, it depends from the expense name.

In the view you can always get with a join.


I’m sorry but I don’t understand good your question

first, you talk about 2 tables so I thought you wanted 2 dependent dropdown

dependent dropdownlist :)

but then, you say

so I think you have only one dropdownlist … when you say "… must be displayed as a non-editable field" what do you mean?? cuz the dropdownlist is a non-editable list

When you say "…and must go into the Expense table" do you want an insert into the DB when you select an item??


Hi ClaCS,

      The dependent drop-down list question was posted as a separate topic by me. In this topic i just wanted to display a value in the database depending on the selected value of the drop-down list .

As you said in this topic there is just one drop-down list . Now depending on the expense-name that i select the corresponding expense-code must be shown to the user as a non editable text-field and must be entered into the database.

I was trying to use Eager Loading for this issue. I saw code which looks like this

<?php Email::model()->with(












Can Any one explain the above code.

thanks for the reply. kindly help me out.