hesap makinem için yardım.

seykofikretyalcinAvatar

http://www.cokacaip.com/deneme/kasap/index.php

işlem olarak sadece toplama yapıyor digerlerini yaptıramıyorum

index.php

<form method="POST" action="hesap.php">
 <p>Hesap Makinesi..</p>
 <p>Sayı1 : <input type="text" name="s1" size="15">
 <p>Topla=>=><input type="radio" value="+" checked name="R1">
 <br>Çıkart=>=><input type="radio" value="-" name="R1">
 <br>Çarp=>=><input type="radio" value="*" name="R1">
 <br>Böl =>=><input type="radio" value="/" name="R1">
 <br><br>
 Sayı2  <input type="text" name="s2" size="15">
 <hr>
 &nbsp;<p><input type="submit" value="Gönder" name="B1"></p>
</form>

hesap.php

<?php
$s1 = $_POST["s1"];
$islem1 = $_POST["R1"];
$islem2 = $_POST["R1"];
$islem3 = $_POST["R1"];
$islem4 = $_POST["R1"];
$s2 = $_POST["s2"];
echo "$s1 ";
if ($islem1){echo "+";}
elseif ($islem1){echo "-";}
elseif ($islem1){echo "*";}
elseif ($islem1){echo "/";}
echo " $s2 =";
if ("$islem1"){
 $topla = 0;
 $topla = $s1 + $s2;
 echo "$topla ";
}
elseif ("$islem2"){
 $cikar = 0;
 $cikar  = $s1 - $s2;
 echo "$cikar";
}
elseif ("$islem3"){
 $carp =0;
 $carp = $s1 * $s2;
 echo "$carp";
 } 
elseif ("$islem4"){
 $bol = 0;
 $bol = $s1 / $s2;
 echo "$bol";
 }
?>
 <p>
 <a href="http://www.cokacaip.com/deneme/kasap/index.php">Dön Geriye Bebeğim..</a>
2011-01-20 01:34:43 Edit:2011-01-20 22:28:33

Php

alicilinAli Fırat Güler

 fikret kardeş Şöyle Bişey yapsak;

sen ilk önce 1 metin alanı bir liste ve ardından bir metin alanı daha yapsan index.php dosyasına.. şimdi gelelim hesap.php dosyasına onada şöyle bişey yapalım

<?php

$alanbir=$_POST["alanbir"];

$liste=$_POST["liste"];

$alaniki=$_POST["alaniki"];

switch ($liste) {

case "+";
echo $alanbir + $alaniki;
break;

case "-";
echo $alanbir - $alaniki;
break;

case "*";
echo $alanbir * $alaniki;
break;

case "/";
echo $alanbir / $alaniki;
break;

}
?>

2011-01-20 08:56:20 Edit:2011-01-20 08:56:42

Php

Fikret < zaten bu siteyi yardım için açtık "dilenme" lafı çok absürt olmuş !!

Her programcı birgün Php yi tadacaktır
2011-01-20 09:24:58

Php

alicilinAli Fırat Güler

Değilmi Hocam :)

2011-01-20 09:26:09

phpkodlari.com © 2009 Herkes Php öğrenecek
Eglence ve Oyun: Gamikro