Re: SELECT data base on a upper level SELECT
[email protected] (Jim Giner)
| Newsgroups | php.general |
|---|---|
| Message-ID | <[email protected]> |
On 7/31/2013 9:37 PM, iccsi wrote: > I have 5 SELECT for Department, Manager, supervisor, Group Leader and > Employees > I want to every SELECT list narrow down for an upper SELECT. > For example, once user select Department then all Manager, Supervisor, > Group Leader and Employee list will be narrow down by department and > same for manager and supervisor and so on. > > I can use iframe or jQuery to do every level, but it needs to call > iframe or jQuery to 5 levels. > I would like to know are there any better way to handle this situation, > > Your help and information is great appreciated, > > Regards, > > > Iccsi, > How about using just one select and add variables to the where clause? Set the variable(s) to the values that you want to filter on. For ex.: your query is $sel = 1; $q = "select Department, Manager, supervisor, Group Leader,Employees where $sel"; Then when the user selects a department $d: $sel = "Department = '$d'"; OR if you have selected a department $d and a manager $m: $sel = "Department ='$d' and Manager='$m'"; One query. A variable 'where' clause.