Re: [PHP-DB] Calculator
Oh! I had gotten the zip file you sent though. Ha, you must have replied to all Well, thanks again. very nice I might add. Karl On Mar 17, 2010, at 3:12 AM, nagendra prasad wrote: Sorry I was not aware that I can not send an attachment. Here is the PHP calculator script: ?php function square( $number ) { $newNumber = $number * $number; return $newNumber; } function cube( $number ) { $newNumber = $number * $number * $number; return $newNumber; } ? html head meta http-equiv=Content-Language content=en-gb meta http-equiv=Content-Type content=text/html; charset=windows-1252 link rel=stylesheet type=text/css href=calculator.css titleCalculator/title /head body div align=center center form method=POST action=calculator.php pTo perform calculations such as squares, square roots, and cubes younbsp; need only fill in the first number field!brbr /p table border=0 cellspacing=1 width=304 id=calculator height=139 tr td width=292 align=center height=39 h3nbsp;Calulator/h3 /td /tr tr td width=292 align=center height=23 input type=text name=this size=10brinput type=text name=that size=10/td /tr tr td width=292 align=center height=24 input type=submit value=+ name=do input type=submit value=- name=do input type=submit value=* name=do input type=submit value=/ name=dobr input type=submit value=^2 name=do input type=submit value=^3 name=do input type=submit value=SqRt name=donbsp; /td /tr ?php if ($do == +){ if (($_POST['this'] != ) ($_POST['that'] != )) { $result = $_POST['this'] + $_POST['that']; } else { $message = font color=\red\You did not fill in both fields! /font; $result = N/A; } } elseif ($do == -){ if (($_POST['this'] != ) ($_POST['that'] != )) { $result = $_POST['this'] - $_POST['that']; } else { $message = font color=\red\You did not fill in both fields! /font; $result = N/A; } } elseif ($do == *){ if (($_POST['this'] != ) ($_POST['that'] != )) { $result = $_POST['this'] * $_POST['that']; } else { $message = font color=\red\You did not fill in both fields! /font; $result = N/A; } } elseif ($do == /){ if (($_POST['this'] != ) ($_POST['that'] != )) { $result = $_POST['this'] / $_POST['that']; } else { $message = font color=\red\You did not fill in both fields! /font; $result = N/A; } } elseif ($do == ^2){ if ($_POST['this'] != ) { $result = square ( $_POST['this'] ); $that = ; } else { $message = font color=\red\You did not fill in the first field!/font; $result = N/A; } } elseif ($do == SqRt){ if ($_POST['this'] != ) { $result = sqrt($_POST['this']); $that = ; } else { $message = font color=\red\You did not fill in the first field!/font; $result = N/A; } } elseif ($do == ^3){ if ($_POST['this'] != ) { $result = cube ( $_POST['this'] ); $that = ; } else { $message = font color=\red\You did not fill in the first field!/font; $result = N/A; } } ? tr td width=292 align=center height=19brbResult: ?php echo($result); ?br?php echo($message); ?/b/td /tr tr td width=292 align=center height=19brPowered by a href=http://www.godfatheruk.com;GodfatherUK/a/td /tr /table /form /center /div /body /html Karl DeSaulniers Design Drumm http://designdrumm.com
Re: [PHP-DB] Calculator
http://www.javascriptkit.com/script/cut18.shtml JS based solution would be the easiest. On Wed, Mar 17, 2010 at 3:07 PM, Karl DeSaulniers k...@designdrumm.comwrote: Hello, I have been asked to see if I can set up an online calculator. I was wondering if anyone had some pointers on where I can lear/find a script that calculates percentages. The regular math part I think I can figure out. Its not a complicated calc, just basic math and percentages calc, a payment calc if you will. TIA Karl DeSaulniers Design Drumm http://designdrumm.com
Re: [PHP-DB] Calculator
Karl DeSaulniers wrote: Hello, I have been asked to see if I can set up an online calculator. I was wondering if anyone had some pointers on where I can lear/find a script that calculates percentages. The regular math part I think I can figure out. Its not a complicated calc, just basic math and percentages calc, a payment calc if you will. loan payments? a bank website should have something like that. search for loan payment calculator and you'll get tons of hits. As for the maths behind it, I'm not sure. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Calculator
This is close. All that functionality with ability to factor in say a 20% discount. Thanks Kesavan Karl On Mar 16, 2010, at 11:22 PM, kesavan trichy rengarajan wrote: http://www.javascriptkit.com/script/cut18.shtml JS based solution would be the easiest. On Wed, Mar 17, 2010 at 3:07 PM, Karl DeSaulniers k...@designdrumm.com wrote: Hello, I have been asked to see if I can set up an online calculator. I was wondering if anyone had some pointers on where I can lear/find a script that calculates percentages. The regular math part I think I can figure out. Its not a complicated calc, just basic math and percentages calc, a payment calc if you will. TIA Karl DeSaulniers Design Drumm http://designdrumm.com Karl DeSaulniers Design Drumm http://designdrumm.com