Kullanıcıdan iki tane tam sayı alıp, alınan bu sayıların toplam sonucunu ekrana yazdıran PHP Örneği
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | <!doctype html> <html> <head> <meta charset="utf-8"> <title>algoritmaonrekleri.com - PHP Örnekleri</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> </head> <body> <div class="container"> <form action="<?=$_SERVER['PHP_SELF']?>" method="post"> <div class="form-group"> <label for="sayi1">Sayı Girin:</label> <input type="text" class="form-control" name="sayi1"> </div> <div class="form-group"> <label for="sayi2">Sayı Girin:</label> <input type="text" class="form-control" name="sayi2"> </div> <button type="submit" name="kontrol" class="btn btn-default" >ÇALIŞTIR</button> </form> </div> <!-- PHP KODLARI --> <div class="container"> <?php if(isset($_POST["kontrol"]))//kontrol adında bir form nesnesi var mı kontrolü yapılıyor { $sayi1=$_POST["sayi1"]; $sayi2=$_POST["sayi2"]; echo "Toplam:".($sayi1+$sayi2); } ?> </div> </body> </html> |
Add Comment