Question: Future Value Calculator Future Value Calculator

/* Here's a good place to use the null coalescing operator

to test the $investment, $interest_rate, $years

to see if they have any values, and set to null otherwise.

This is because this page will be loaded the very first time

when these variables have never been used before (no values yet),

as well as when there have been errors detected and the page

is reloaded. No way of knowing unless you test the variables.

What kind of test? If you attempt to assign $investment to $investment (yup, you read that correctly--assign it to itself!), and if it's not set, assign it a NULL. Then, it won't be considered "undefined" when you attempt to print it later in the form. But, interestingly, if the user doesn't enter anything for it, and you attempt to post $investment to the next page (display_results.php), it will be considered an empty string and will pass that test next time. Whew!

*/

?>

Future Value Calculator

Future Value Calculator

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!