PHP Birden Fazla Formdan Bilgi Alma

Ekran Görüntüsü

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .sonuc_yazisi{
            width:45%;
            background-color: lightgreen;
            margin:auto;
            padding: 50px;
            font-size:2em;
            color:black;
            text-align:center;
        }
        form{
            width: 20%;
            border: 1px black solid;
            border-radius:30px;
            margin:auto;
            margin-top:10px;
            margin-bottom:10px;
            padding: 30px;
        }
        </style>
</head>
<body>
    
    <!--100'luk not sisteminden 5'lik not sistemine dönüşüm  -->
    
    <form action="" method="post">
        <h2>100 ->5 Not Dönüşümü</h2>
        <input type="text" name="notbilgisi" id="">
        <input type="submit" value="Gönder" name="notdonusumu">
    </form>

   
    <!-- TL den Dolara dönüşüm.-->
    <form action="" method="post">
        <h2>TL -> Dolar  Dönüşümü</h2>
        <input type="text" name="tldegeri" id="">
        <input type="submit" value="Gönder" name="paradonusumu">
    </form>

    <div class="sonuc_yazisi">
    <?php
$DOLAR_KURU =14.6;
// Hangi Formdan bilgi geldi

if (isset($_POST["notdonusumu"])){
    echo "Not Dönüşümü Yapılacak<br>";
    
    if  (!empty($_POST["notbilgisi"])){
       $notbilgisi = $_POST["notbilgisi"];
 $mesaj="";
    if ($notbilgisi>=0 && $notbilgisi<=100){
        if ($notbilgisi > 0  && $notbilgisi<= 24 ){ $mesaj = 0;}
        if ($notbilgisi > 25  && $notbilgisi<= 44 ){ $mesaj = 1;} 
        if ($notbilgisi > 45  && $notbilgisi<= 54 ){ $mesaj = 2;}
        if ($notbilgisi > 55  && $notbilgisi<= 69 ){ $mesaj = 3;}      
        if ($notbilgisi > 70  && $notbilgisi<= 84){ $mesaj = 4;}   
        if ($notbilgisi > 85  && $notbilgisi<= 100){ $mesaj = 5;}  

        echo "$notbilgisi notunun Beşlik sistemdeki Not Karşılığı $mesaj dır. ";

        for ($i=1; $i <= $mesaj ; $i++) { 
            # başlangıç ; şart kontrol ; her adımdaki artış.
            echo "<img width=100 src='star.png'>";
        }

    }
    else 
    { echo "Not Bilgisi 0-100 arası bir değer olmalıdır.";}
 
    } else {
        echo "Not Girmediniz.";
    }

    
    
}

if (isset($_POST["paradonusumu"])){
    echo "Para Dönüşümü Yapılacak";
    if (!empty($_POST["tldegeri"]))
    {
         $tldegeri = $_POST["tldegeri"];
    $dolar_miktari = $tldegeri / $DOLAR_KURU;
    
    echo "<br>Girilen $tldegeri TL değeri için <br> Dolar Miktarı $dolar_miktari ";
    } else
    {
        echo "Değer Girmediniz.";
    }
   



}



?>
    </div>
</body>
</html>

İlk yorum yapan olun

Bir yanıt bırakın

E-posta hesabınız yayımlanmayacak.


*