You are here: Re: [PHP] Control Structures « PHP « IT news, forums, messages
Re: [PHP] Control Structures

Posted by Marek Kilimajer on 02/06/05 22:16

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация