Question

I'm using codeigniter and grocery crud. I'm having a trouble in implementing a dropdownlist. When I add a data in the deduction table what I want to do is display all employee names which can be determined by having an entry in employee table. Once the name is selected, on saving, it should save the employeeID which can be obtained from the employee table. Your help will be appreciated, thank you in advance.

Relation Table

Was it helpful?

Solution

For your deduction table:

$crud->set_relation('employeeID','employee','employeeID');

This should go into your deductions controller you will receive a dropdown that displays employeeID and the objects those ids belong to.

For your employee table

$crud->set_relation('employeeID','member',memberID);

This should go into employee controller you will receive a dropdown that displays employeeID and the objects those ids belong to.

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top