Page 1 of 1
help from selecting from list
Posted: Fri Sep 11, 2009 6:30 am
by om.bitsian
hi all
i have two lists 1. Employee type(1,2,3) and 2. designation(around 50)
i want somthing like if (employee tpye==1) so it should show some designation which come under this type from designation list i.e
LECT, ASST, PROF etc
if (employee tpye==2) it should show some other designation from designation list i.e
PA, JOAT,JAAT etc.....
if (employee tpye==3) it should show only the designation which come under this perticular employee type ...
is it possible in php.....
thanks
Re: help from selecting from list
Posted: Fri Sep 11, 2009 6:38 am
by Weiry
Where abouts are you storing your employee types?
Also, is there something somewhere that defines which employee types are related to a designation?
such as..
Employee type 1 -> has relation to -> LECT / PROF
Employee type 2 -> has relation to -> ASST
Re: help from selecting from list
Posted: Fri Sep 11, 2009 6:48 am
by om.bitsian
i am storing EMP_TYPE(1,2,3) in "major" table and in the same table i am having other column DESIG.......DESIG list contain (LECT,PROF,JOAT....etc)
now i want to seperate employee by their designation....
so shall i create new table in that i can write DESIG and emplyee type to link then
out put : when i select employee type 1 than in the DESIGNATION list it should show only the values come uder employye type 1.....it should not show other designation
Re: help from selecting from list
Posted: Fri Sep 11, 2009 7:07 am
by Weiry
Ok so from my understanding, each variation in your table will look something like this
Code: Select all
[u]EMP_TYPE | DESIG [/u]
1 | LECT
1 | PROF
2 | ASST
A simple query such as:
Code: Select all
$query = "SELECT `DESIG`,`EMP_TYPE` FROM `MAJOR` WHERE `EMP_TYPE` = '{$employee_type}'";
all you would need to do, is send the $employee_type through a form to the page where the query will be executed.
from there to print all types, you would just do a simple while loop:
Code: Select all
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
print "Employee Type: {$row['EMP_TYPE']} has the following designations:<br/>";
while($row){
print "{$row['DESIG']} , ";
}
something like that should print the designations for the specified employee type