- Katılım
- 7 Mar 2018
- Mesajlar
- 719
- Beğeniler
- 16
- Yaş
- 28
PHP:
<?php
error_reporting(0);
//Gencportal.Org
//php hesap makinası scripti
//online kullan
//http://www.gencportal.org/online/hesap-makinasi.php
?>
<body bgcolor="whitesmoke"><form method="post" action=""><center>
<p><h1 style="color:#30793F">Gencportal.Org<br>
Hesap makinası</h1></p>
<table width="20%" align="center">
<tr>
<td width="50">1.Sayı</td><td><input type="text" name="sayi1"></td></tr>
<tr>
<td width="50">2.Sayı</td><td><input type="text" name="sayi2"></td></tr>
<tr>
<td width="50">Topla </td><td><input type="radio" name="islem" value="topla"></td></tr>
<tr><td width="50">Çıkar </td><td><input type="radio" name="islem" value="cikar"></td></tr>
<tr><td width="50">Çarp </td><td><input type="radio" name="islem" value="carp"></td></tr>
<tr><td width="50">Böl </td><td><input type="radio" name="islem" value="bol"></td></tr>
<tr><td width="50"></td><td><input type="submit" value="Hesapla"></td></tR>
</table>
</form>
</body>
<?php
$islem=$_POST['islem'];
$sayi1=strip_tags(htmlspecialchars($_POST['sayi1']));
$sayi2=strip_tags(htmlspecialchars($_POST['sayi2']));
if($sayi1!=='' and $sayi2!==''){
if($islem=='topla'){
$tgoster=$sayi1+$sayi2;
echo 'Sonuç :'.$tgoster;
}
if($islem=='cikar'){
$cgoster=$sayi1-$sayi2;
echo 'Sonuç :'.$cgoster;
}
if($islem=='carp'){
$crgoster=$sayi1*$sayi2;
echo 'Sonuç :'.$crgoster;
}
if($islem=='bol'){
$bgoster=$sayi1/$sayi2;
echo 'Sonuç :'.$bgoster;
}
}else{echo 'alanları doldurunuz';}
?>