Discussion:
SELECT data base on a upper level SELECT
iccsi
2013-08-01 01:37:09 UTC
Permalink
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,
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2013-08-01 13:09:28 UTC
Permalink
Post by iccsi
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.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
iccsi
2013-08-01 22:33:07 UTC
Permalink
Thanks for the information and help,
The query can solve server side, but client side, user might select any one
dropdown, for example, user might select manager from drop down without
choose Department dropdown.

For this case, application needs inject data for supervisor and lower level,

Thanks again for helping,

Regards,

Iccsi,
Post by iccsi
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.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
jomali
2013-08-01 22:52:45 UTC
Permalink
Post by iccsi
Thanks for the information and help,
The query can solve server side, but client side, user might select any
one dropdown, for example, user might select manager from drop down without
choose Department dropdown.
For this case, application needs inject data for supervisor and lower level,
No, simply prevent client from submitting form until all required fields
are filled in. (A blindingly simple procedure).
Post by iccsi
Thanks again for helping,
Regards,
Iccsi,
Post by iccsi
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.
your query is
$sel = 1;
$q = "select Department, Manager, supervisor, Group Leader,Employees
where $sel";
$sel = "Department = '$d'";
$sel = "Department ='$d' and Manager='$m'";
One query. A variable 'where' clause.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Loading...