Zend - The PHP Company




Calculators

Add Code


A simple calculator !  

Type: application
Added by: orfeuRO
Entered: 31/01/2004
Last modified: 02/12/2003
Rating: - (fewer than 3 votes)
Views: 7591
A simple calculator. Must be in calculator.php


<!-- A simplu calculator by Serban Nicolae @2004 orfeu@as.ro -->
<html>
<head>
<title>A simple calculator !</title>
</head>
<body>
<h3> A simple calculator </h3>

<form method="post" action="calculator.php">

<input type="text" size="6" name="op1" value="<? echo $op1 ?>" >

<select name="o"> <option value="1">+</option>
                  <option value="2">-</option>
                  <option value="3">*</option>
                  <option value="4">/</option>
</select>

<input type="text" size="6" name="op2" value="<? echo $op2 ?>" >
  <br>
<input name="text" type="text" name="op3" value="

<?php 
switch ($o
{ case 
1$op3=$op1+$op2; break;
  case 
2$op3=$op1-$op2; break;
  case 
3$op3=$op1*$op2; break;
  case 
4$op3=$op1/$op2; break;
}
echo 
$op3;

?>" disabled>

<input type="submit" value="=" >
</form>

</body>

</html>


Usage Example




Rate This Script





Search



This Category All Categories