Hello Ragezoners , i made a calculator , its VERY SIMPLE tho , dont flame me.
so here it is !
PHP Code:<h1>Simple calculator - Usable</h1>
<h3>Source by foxx - thank you and edited by StronGCoder</h3>
<h1>Simple calculator - Usable</h1>
<h3>Source by foxx - thank you and edited by StronGCoder</h3>
<?php
// source by foxx - thanks!
// edited by strong
// advanced calculator coming soon!
$result = "";
if (isset($_POST['val'])) {
$val = (float)$_POST['val'];
$val2 = (float)$_POST['val2'];
if (!$val and $val2) {
$result .= "<p>Fill all fields , please!</p>";
}
if (!$result) {
switch ($_POST['operator']) {
case "sum":
$result = $val.'+'.$val2.' = '.$val+$val2;
break;
case "sub":
$result = $val.'-'.$val2.' = '.$val-$val2;
break;
case "mul":
$result = $val.'*'.$val2.' = '.$val*$val2;
break;
case "div":
$result = $val.'/'.$val2.' = '.$val/$val2;
break;
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cz" lang="cz">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en" />
<title>Calculator by StronGCoder</title>
</head>
<body>
<form method="post" action="/calculator/index.php">
<label for="val"></label>
<input type="text" name="val" id="val" value='First number' />
<label for="operator"></label>
<select name="operator" id="operator">
<option value="Choose">Choose one :</option>
<option value="sum">+</option>
<option value="sub">-</option>
<option value="mul">*</option>
<option value="div">/</option>
</select>
<label for="val2"></label>
<input type="text" name="val2" id="val2" value='Second number' />
<input type="submit" name="submit" value='Calculate' />
</form>
<?php
echo $result;
?>
</body>
</html>
credits
50% - foxx - the base source
50% - me - coding , fixing , editing !
thanks!:thumbup:

