recent posts

banner image

Php form ile basit bir hesap makinesi yapmak

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="carpma.php" method="post">
1.Sayı<input type="text" name="sayi1" /><br />
2.Sayı<input type="text" name="sayi2" /><br />
İşlem Seçiniz:<br />
Toplama<input type="radio" name="islem" value="toplama" /><br />
Çıkarma<input type="radio" name="islem" value="cikarma" /><br />
Çarpma<input type="radio" name="islem" value="carpma" /><br />
Bölme<input type="radio" name="islem" value="bolme" /><br />
<input type="submit" name="gonder" value="Hesapla" /><br />
</form>
</body>
<?php
if(isset($_POST["gonder"]) && isset($_POST["islem"]))
{
$s1=$_POST["sayi1"];
$s2=$_POST["sayi2"];
$islem=$_POST["islem"];
if($islem=="toplama")
{
echo $s1+$s2;
}
else if($islem=="cikarma")
{
if($s1>$s2) echo $s1-$s2;
else echo $s2-$s1;
}
else if($islem=="carpma")
{
echo $s1*$s2;
}
else if($islem=="bolme")
{
echo $s1/$s2;
}
}
 ?>
Php form ile basit bir hesap makinesi yapmak Php form ile basit bir hesap makinesi yapmak Reviewed by Abdulhamit Ekşioğlu on Kasım 15, 2015 Rating: 5

Hiç yorum yok:

Blogger tarafından desteklenmektedir.