This topic is locked

Drop Down Dependant on User

8/25/2009 5:06:59 PM
PHPRunner General questions
J
jvoirol author

Hi!
I am working on a time sheet application and I have used a piece of code that Jane provided to make drop down values stored in a table display dependent on a value in a field in the user table. There are only 2 choices in the user table, salary and hourly and if the user is salary then the drop down contains all of the entries, and if the user is hourly then the choices contain only those records with a type of hourly. Here is the code you provided:
if (@$_SESSION["varWageType"]!="salary")

$_SESSION["wage_class"] = " salary_class!='salary' ";

else

$_SESSION["wage_class"] = " 1=1 "
This works very well but now we want to change it so that there are 4 wage types, hourly, salary, corporate and all. I want to be able to make the drop down dependent on the wage type (salary, hourly, corporate) and I also want to display the records that are of the wage type of "all" for everyone. So I have 3 different choices:
hourly and all

salary and all

corporate and all
Any help on the logic and code to make this work will be greatly appreciated.
Thanks

J
Jane 8/26/2009

Hi,
here is a sample:

if (@$_SESSION["varWageType"]=="salary")

$_SESSION["wage_class"] = " salary_class='salary' and salary_class='all' ";

if (@$_SESSION["varWageType"]=="hourly")

$_SESSION["wage_class"] = " salary_class='hourly' and salary_class='all' ";
J
jvoirol author 8/26/2009



Hi,
here is a sample:

if (@$_SESSION["varWageType"]=="salary")

$_SESSION["wage_class"] = " salary_class='salary' and salary_class='all' ";

if (@$_SESSION["varWageType"]=="hourly")

$_SESSION["wage_class"] = " salary_class='hourly' and salary_class='all' ";



That did not work, but thanks to your sample I figured it out. It should be an "or" instead of an "and" because salary_class cannot be hourly AND all it is either hourly OR all.
Thanks for all of your help, you are the best;-)