Re: Control Structures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Wil wrote:
To PHP list:

The following code is attempting to compare the salary to the four other pre-defined variables with if and else statements. So the final output should result in 4 different statements. What is the best way to do this? Following is the code...

<?php
$currentmax = 1049;
$maximum1 = 1420;
$maximum2 = 1692;
$maximum3 = 1901;

if ($salary < $currentmax) {
echo "Currently, you pay approximately $ ", round ($salary * .0055 * 52 / 12, 2), " per month in dues.<br>";}
else
{
echo "You currently pay the maximum monthly dues of $25";
}


if ($salary < maximum1); {
echo "After phase 1 of the proposed increase, your monthly dues amount will be $ ", round ($salary *.0065 * 52 / 12,2);
}
else
{
echo ("You pay the maximum monthly dues of $40";)
}


if ($salary < $maximum2); {
echo ("<br>After phase 2 of the proposed increase, your monthly dues amount will be $ ",round ($salary *.0075 * 52 / 12,2);
else
echo ("You pay the maximum monthly dues of $55");
}


if ($salary < $maximum3); {
echo ("<br>After phase 3 of the proposed increase, your monthly dues amount will be $ ", round ($salary *.0085 * 52 / 12,2);
else
echo ("You pay the maximum monthly dues of $70");
}


?>

I am still a newbie so any help with this code will be great...

You did not say what your output should look like, but as a start you can fix your code of parse errors and see if the output is what you need.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux