Call us Toll-Free:
1-800-218-1525
Email us

 Sponsors

Calculater

Code Wizard, 12-30-2006

This is a calculater that can add, subtract, multiply, and divide. You need two files, and they have to be these names, unless you feel like doing some code editing. Put them inside the same folder.

// First file: a html file
<form action="calculater.php3" method="post">
<center><input type="text" name="num"> <select name="by"><option value="add">Add<option value="minus">Minus<option value="times">Multiply<option value="divide">Divide</select> <input type="text" name="num2"> <input type="submit" value="Calculate"></center>
</form>


// Next file: a php file save as: calculater.php3.
<?

if($by == "add"){
echo $num + $num2;
} elseif($by == "minus"){
echo $num - $num2;
} elseif($by == "times"){
echo $num * $num2;
} elseif($by == "divide"){
echo $num / $num2;
}

?>
Enjoyed this post?

Subscribe Now to receive new posts via Email as soon as they come out.

 Comments
Post your comments












Note: No link spamming! If your message contains link/s, it will NOT be published on the site before manually approved by one of our moderators.



About Us  |  Contact us  |  Privacy Policy  |  Terms & Conditions