Investment Growth

[insert_php]
echo ‘

‘;

$sample_returns = ‘
Sample Annual Returns from 1/2/1970 – 12/30/2016 or earliest date available for stock.
MO = 20.11; AAPL = 16.80; KO = 14.04; S&P 500 = 7.58′;

if(isset($_POST[‘submit’])) {

echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

‘;
echo ‘

Enter Beginning Amount:
Enter Annual Contribution: How many years?
Enter Annual Percent Increase:
Enter Number of Years:

‘;

echo $sample_returns;

$start_amount = $_POST[‘start_amount’];
$perc_increase = $_POST[‘perc_increase’]/100;
$years = $_POST[‘years’];
$cont_years = $_POST[‘cont_years’];
$annual_amount = $_POST[‘annual_amount’];
$x = 1;

setlocale(LC_MONETARY, ‘en_US’);

/* Print table header */
echo “

“;
echo ‘

‘;

while($x <= $years) { echo "

“;
echo “

“;
echo “

“;

if ($x > $cont_years) {
$annual_amount = 0;
}
echo “

“;

echo “

“;
echo “

“;
echo “

“;
$start_amount = ($start_amount * (1 + $perc_increase)) + $annual_amount;
$x++;

}
echo “

Year Beginning Amount Investment Gains Annual Contributions Ending Amount Hourly Rate
(Investment Gains)
$x ” . money_format(‘%#20.0n’, $start_amount) . “ ” . money_format(‘%#20.0n’, ($start_amount * $perc_increase)) . “ ” . money_format(‘%#20.0n’, ($annual_amount)) . “ ” . money_format(‘%#20.0n’, (($start_amount * (1 + $perc_increase)) + $annual_amount)) . “ ” . money_format(‘%#20.2n’, (($start_amount * $perc_increase)/2080)) . “

“;
}

else {

echo ‘

Enter Beginning Amount:
Enter Annual Contribution: How many years?
Enter Annual Return:
Enter Number of Years:

‘;

echo $sample_returns;

}

[/insert_php]