01202003 1702 CST
Ive been going back over all these exercises trying to do them with the
Global Variables off. Its much more difficult.
Below is the exercise on Switch and Case. Im uncertain about the
$_X["Y"] in each statement. This code currently produces nothing when run.
<?php
$Duration = 0;
switch ($_POST["Loan"])
{
case 1000:
$Interest = 5;
break;
case 5000:
$Interest = 6.5;
break;
case 10000:
$Interest 8;
break;
default:
echo "You didnt enter a loan package!";
break;
}
while ($_POST["Loan"] > 0)
{
$Duration = $Duration + 1;
$Monthly = $_POST["Month"] - ($_POST["Loan"] * $Interest / 100);
if ($Monthly <=0)
{
echo "You need larger repayments to pay off your loan!";
exit;
}
$_POST["Loan"] = $_POST["Loan"] - $Monthly;
}
echo "This would take you $Duration months to pay this off at the
interest rate of $Interest percent.";
?>
Wade
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php