hesap makinem için yardım

seyko fikretyalcin Avatar

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>
cokacaip.com
20-01-2011 01:34 Edit:20-01-2011 22:28

    Php

    alicilin Ali 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;

    }
    ?>

     

     

     

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

      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
      20-01-2011 09:24

        Php

        alicilin Ali Fırat Güler

        Değilmi Hocam :)

        20-01-2011 09:26

          www.Phpkodlari.com © 2009 Herkes Php öğrenecek
          Web tasarım ve eğitim kaynağınız.