PHP İle Basit Hesap Makinesi Yapımı

PHP ile yapmış oldugumuz basit bir php hesap makinesi programını sizlerle paylaşıyorum.

hesapla.html


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
<title>Hesap Makinesi</title>
</head>

<body>
<form action="sonuc.php" method="post">
 <table width="200" border="1">
 <tr>
 <th scope="col">Sayı 1</th>
 <th scope="col"><input type="text" name="sayi1" id="sayi1" /></th>
 </tr>
 <tr>
 <td>İşsayo2 </td>
 <td><input type="text" name="sayi2" id="sayi2" /></td>
 </tr>
 <tr>
 <td>İşlem T&uuml;r&uuml;</td>
 <td><select name="islem" id="islem">
 <option value="+">+</option>
 <option value="-">-</option>
 <option value="*">*</option>
 <option value="/">/</option>
 </select></td>
 </tr>
 <tr>
 <td>G&ouml;nder</td>
 <td><input type="submit" name="Gonder" id="Gonder" value="gonder" /></td>
 </tr>
 </table>
</form>
</body>
</html>

sonuc.php

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
<title>Sonuc Sayfası</title>
</head>

<body>
<?php
$sayi1 = $_POST['sayi1'];
$sayi2 = $_POST['sayi2'];
$islem = $_POST['islem'];
if ($islem == "+")
{
 $sonuc = $sayi1 + $sayi2;
}
elseif($islem == "-")
{
 $sonuc = $sayi1 - $sayi2;
}
elseif($islem == "*")
{
 $sonuc = $sayi1 * $sayi2;
}
elseif($islem == "/")
{
 $sonuc = $sayi1 / $sayi2;
}
echo $sonuc;
?>
</body>
</html>


Twitter Digg Delicious Stumbleupon Technorati Facebook
Yazar :

PHP Programcısı

http://www.tasarimrehberi.com

3 Yorum “PHP İle Basit Hesap Makinesi Yapımı”

  1. bir -acıklama felan yazsaydın iyi olurdu neyse sagol

  2. Açıklama yapmamıza gereken bir kısım yokki :)
    Basit bir hesap makinesi deneyin zaten göreceksiniz

  3. slm.a kardeş bunun c dilinde elinde kaynak varmı?