[eluser]ivantcholakov[/eluser]
@rainfall
1. Your code in the model is strange. Why do you iterate the query result and then you just return it? What is $groups array there for?
2. It would be better if you populate your dropbox options this way and then to adapt other code accordingly:
Code:
// Employees is an array.
foreach($employees as $emp_id => $employee_name)
{
echo '<option value="'.$emp_id.'">'.$employee_name.'</option>';
}
The idea is your dropbox to select employee ID directly.
3. Check what would happen if the query does not return anything. Also, in your dropbox maybe you need a default option at the beginning:
Code:
echo '<option value="">-- Choose an Employee --</option>';
Deal with the case when there is no Employee selected.