Re: Control Structures
| From: | Marek Kilimajer | Date: | Sun, 06 Feb 2005 20:16:31 +0000 |
| Subject: | Re: Control Structures | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-208154@lists.php.net to get a copy of this message | ||
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.