wap sitenize koyacağınız bir hesap makinesi.
<?php
header("Content-type: text/vnd.wap.wml; charset=ISO-8859-9");
header("Cache-Control: no-store, no-cache, must-revalidate");
echo("<?xml version=\"1.0\" encoding=\"iso-8859-9\"?>");
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"". " \"
http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<wml>
<card id="bilo" title="kayseriwap.com">
<p align="left">
<?
function show()
{
global $action;
?>
<?php
echo "
1.sayı:<br/> <input type=\"text\" name=\"first\" format=\"*N\"/><br/>
2.sayı: <br/><input type=\"text\" name=\"second\" format=\"*N\"/><br/><br/>
<select size=\"1\" name=\"action\">
<option value=\"sum\">topla</option>
<option value=\"min\">cikar</option>
<option value=\"mult\">carp</option>
<option value=\"dev\">böl</option>
</select>
<br/>
<anchor>Tamam<go href='calc.php' method='post'>
<postfield name=\"first\" value=\"$(first)\"/>
<postfield name=\"second\" value=\"$(second)\"/>
<postfield name=\"action\" value=\"$(action)\"/>
</go></anchor>";
?>
<?php
} //.()
function calc()
{
global $action, $result, $first, $second;
switch($action)
{
case "sum": $result = $first+$second; break;
case "min": $result = $first-$second; break;
case "mult": $result = $first*$second; break;
case "dev":
if (!$second) /* . ÷. "0" . */
{
exit(".");
}
$result=$first/$second; break;
case "procent": $result = $first*($second/100); break;
case "stepen": $result = pow($first, $second); break;
case "koren": $result = pow($first,0.5); break;
}
?>
<?php
echo". <b> $result</b> ";
?>
<?
} //.calc()
if ($action) calc(); else show();
?>
<?php
echo"</p></card></wml>";
?>