Download presentation
Presentation is loading. Please wait.
Published byJonathan Hinkley Modified over 9 years ago
1
Murach's PHP and MySQL, C2© 2010, Mike Murach & Associates, Inc.Slide 1
2
Murach's PHP and MySQL, C2© 2010, Mike Murach & Associates, Inc.Slide 2
3
Murach's PHP and MySQL, C2© 2010, Mike Murach & Associates, Inc.Slide 3
4
Murach's PHP and MySQL, C2© 2010, Mike Murach & Associates, Inc.Slide 4
5
Murach's PHP and MySQL, C2© 2010, Mike Murach & Associates, Inc.Slide 5
6
Murach's PHP and MySQL, C2© 2010, Mike Murach & Associates, Inc.Slide 6
7
Murach's PHP and MySQL, C2© 2010, Mike Murach & Associates, Inc.Slide 7
8
Murach's PHP and MySQL, C2© 2010, Mike Murach & Associates, Inc.Slide 8 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional...> Future Value Calculator Future Value Calculator Investment Amount: <input type="text" name="investment" value=" "/> Yearly Interest Rate: <input type="text" name="interest_rate" value=" "/> Number of Years: <input type="text" name="years" value=" "/>
9
Murach's PHP and MySQL, C2© 2010, Mike Murach & Associates, Inc.Slide 9 <?php // get the data from the form $investment = $_POST['investment']; $interest_rate = $_POST['interest_rate']; $years = $_POST['years']; // validate investment entry if ( empty($investment) ) { $error_message = 'Investment is a required field.'; } else if ( !is_numeric($investment) ) { $error_message = 'Investment must be a valid number.'; } else if ( $investment <= 0 ) { $error_message = 'Investment must be greater than zero.'; // validate interest rate entry } else if ( empty($interest_rate) ) { $error_message = 'Interest rate is a required field.'; } else if ( !is_numeric($interest_rate) ) { $error_message = 'Interest rate must be a valid number.'; } else if ( $interest_rate <= 0 ) { $error_message = 'Interest rate must be greater than zero.'; // apply currency and percent formatting $investment_f = '$'.number_format($investment, 2); $yearly_rate_f = $interest_rate.'%'; $future_value_f = '$'.number_format($future_value, 2); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional...> Future Value Calculator Future Value Calculator Investment Amount: Yearly Interest Rate: Number of Years: Future Value:
10
Murach's PHP and MySQL, C2© 2010, Mike Murach & Associates, Inc.Slide 10
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.