Kod:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>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">
<h1 class="bg-primary">
<?php
if(isset($_POST["kontrol"]))//kontrol adında bir form nesnesi var mı kontrolü yapılıyor
{
echo $_POST["sayi1"]+$_POST["sayi2"];
}
?>
</h1>
<hr>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<div class="form-group">
<label for="sayi1">Sayı 1</label>
<input type="text" class="form-control" name="sayi1">
</div>
<div class="form-group">
<label for="sayi2">Sayı 2</label>
<input type="text" class="form-control" name="sayi2">
</div>
<button type="submit" name="kontrol" class="btn btn-default" >Kontrol Et</button>
</form>
</div>
</body>
</html>