Hesap Makinesi
PHP Uygulamaları Mart 3rd, 2007PHP ile bir dört işlem makinesi geliştirdim.
Ve kodlarımız şöyle:
index.php
HTML:
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-
-
<style type="text/css"> <!-- .style13 {font-size: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; } .style16 {font-family: Georgia, "Times New Roman", Times, serif; font-weight: bold; font-size: 24px;} .style17 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; } --> </style>
-
<p class="style16">Hesap Makinası</p>
-
-
<form id="form1" name="form1" method="post" action="islem.php">
-
<table border="0" width="250">
-
<label>1. Sayı :</label>
-
</tr>
-
<label>2. Sayı :</label>
-
</tr>
-
<label>İşlem türü:</label>
-
</tr>
-
</tr>
-
</table>
-
</form>
islem.php
PHP:
-
$toplam = ($sayi1 + $sayi2);
-
$carpim = ($sayi1 * $sayi2);
-
$fark = ($sayi1 - $sayi2);
-
$bolum = ($sayi1 / $sayi2);
-
switch($islemturu)
-
{
-
case "topla" :
-
echo "Iste sonuç: <strong>$toplam</strong>. Geri dönmek için <font color="red" face="verdana"><a href="javascript:history.go(-1)">tiklayin...</a></font>";
-
break;
-
case "carp" :
-
echo "Iste sonuç: <strong>$carpim</strong>. Geri dönmek için <font color="red" face="verdana"><a href="javascript:history.go(-1)">tiklayin...</a></font>";
-
break;
-
case "cikar" :
-
echo "Iste sonuç: <strong>$fark</strong>. Geri dönmek için <font color="red" face="verdana"><a href="javascript:history.go(-1)">tiklayin...</a></font>";
-
break;
-
case "bol" :
-
echo "Iste sonuç: <strong>$bolum</strong>. Geri dönmek için <font color="red" face="verdana"><a href="javascript:history.go(-1)">tiklayin...</a></font>";
-
break;
-
case "islemsec" :
-
echo "<font color="red" face="verdana"><a href="javascript:history.go(-1)">Lütfen geri dönüp bir islem seçin.</a></font>";
-
break;
-
}
-
?>