-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInternetProgramciligi2FormOrnek.php
48 lines (48 loc) · 2 KB
/
InternetProgramciligi2FormOrnek.php
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
40
41
42
43
44
45
46
47
48
<html>
<head>
</head>
<body>
<form action="" method="POST">
<label for="">Ürün Adedi</label>
<input required type="number" name="adet"value="<?php if(isset($_POST['adet'])){echo $_POST['adet'];} ?>"><br>
<label for="">Birim Fiyatı</label>
<input required type="number" name="birim" value="<?php if(isset($_POST['birim'])){echo $_POST['birim'];} ?>"><br>
<input type="checkbox" name="KDV" <?php if(isset($_POST['KDV'])){echo "checked";}?>>
<label for="">%18 KDV</label><br>
<input type="checkbox" name="discount" <?php if(isset($_POST['discount'])){echo "checked";}?>>
<label for="">%5 Öğrenci İndirimi</label><br>
<input type="submit" name="submit" value="Hesapla">
</form>
</body>
</html>
<?php
if(isset($_POST['submit'])){
$proNumber = $_POST['adet'];
$proPrice = $_POST['birim'];
if(isset($_POST['KDV'])){
if(isset($_POST['discount'])){
$total = $proNumber * $proPrice;
$total = $total + ($total * 0.18);
$total = $total - ($total * 0.05);
echo "<label style='margin-right:10px;'for=''>Toplam Fiyat = </label>";
echo "<input type='text' value='$total'>";
}else{
$total = $proNumber * $proPrice;
$total = $total + ($total * 0.18);
echo "<label style='margin-right:10px;'for=''>Toplam Fiyat = </label>";
echo "<input type='text' value='$total'>";
}
}else{
if(isset($_POST['discount'])){
$total = $proNumber * $proPrice;
$total = $total - ($total * 0.05);
echo "<label style='margin-right:10px;'for=''>Toplam Fiyat = </label>";
echo "<input type='text' value='$total'>";
}else{
$total = $proNumber * $proPrice;
echo "<label style='margin-right:10px;'for=''>Toplam Fiyat = </label>";
echo "<input type='text' value='$total'>";
}
}
}
?>