<?php
require_once("Annuity.php");
// Check to see that each of the variable passed in are numbers
if (is_numeric($_REQUEST['payment'])) {
  
$payment $_REQUEST['payment'];
}
if (
is_numeric($_REQUEST['interest'])) {
  
$rate $_REQUEST['interest'];
  
$monthly_rate $rate 12;
}
if (
is_numeric($_REQUEST['years'])) {
  
$years $_REQUEST['years'];
  
$periods $years 12;
}

if ((
== $payment) || (== $rate) || (== $years)) {
  print 
"The values entered need to be non-zero.<br />\n";
  exit;
}

if (
$rate 1) {
  print 
"The interest rate needs to be entered as a decimal number.<br />\n";
  exit;
}

$fva FutureValueofAnnuity($payment$monthly_rate$periods);
print 
"You are investing \$$payment per month at an annual rate of " $rate 100 "% for $years years.<br />\n";
print 
"Your investment return is \$" round($fva2) . " on \$" $payment $periods " invested.<br />\n";

?>