PHP Kod:
<!DOCTYPE html>
<html>
<head>
<title>WebAilesi.Com - Emrullah AKTAŞ</title>
<meta charset="utf-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
</head>
<body style = "background-color: black;">
<form action = "Index_Sender.php" method = "POST" style = "text-align: center;"> <br>
<input type = "Text" name = "Car_Brand" placeholder = "Markasını Giriniz" style = "border: solid #FFD700;"> <br>
<input type = "Text" name = "Car_Model" placeholder = "Modelini Giriniz" style = "border: solid #FFD700;"> <br>
<input type = "Text" name = "Car_Year" placeholder = "Yılını Giriniz" style = "border: solid #FFD700;"> <br>
<input type = "Text" name = "Car_Fuel" placeholder = "Yakıt Durumunu Giriniz" style = "border: solid #FFD700;"> <br>
<input type = "Text" name = "Car_Damage_Record" placeholder = "Hasar Kaydını Giriniz" style = "border: solid #FFD700;"> <br><br>
<input type = "Submit" value = "Bilgileri Gönder">
</form>
</body>
</html>
Index_Sender.php
PHP Kod:
<?php
$Car_Brand = $_POST['Car_Brand'];
$Car_Model = $_POST['Car_Model'];
$Car_Year = $_POST['Car_Year'];
$Car_Fuel = $_POST['Car_Fuel'];
$Car_Damage_Record = $_POST['Car_Damage_Record'];
if($Car_Damage_Record == '')
{
$Car_Damage_Record = " - ";
}
$Data_Base = new PDO("mysql:host=localhost; dbname=galeri;", "root", "");
$Data_Base -> Query("Insert Into arac(Marka, Model, Yil, Yakit_Durumu, Hasar_Kaydi)
Values('".$Car_Brand."', '".$Car_Model."', '".$Car_Year."', '".$Car_Fuel."', '".$Car_Damage_Record."')");
echo "<h3>Yeni Eklediğin Arabanın Bilgileri</h3>";
echo "Arabanın Markası: " . $Car_Brand . "<br>";
echo "Arabanın Modeli: " . $Car_Model . "<br>";
echo "Arabanın Yılı: " . $Car_Year . "<br>";
echo "Arabanın Yakıt Durumu: " . $Car_Fuel . "<br>";
echo "Arabanın Hasar Kaydı: " . $Car_Damage_Record . "<br><br>";
$Control = $Data_Base -> prepare("Select * From arac");
$Control -> execute();
echo "<table border = '1'>
<tr>
<th>Arabanın Markası</th>
<th>Arabanın Modeli</th>
<th>Arabanın Yılı</th>
<th>Arabanın Yakıt Durumu</th>
<th>Arabanın Hasar Kaydı</th>
</tr>";
while($row = $Control -> FETCH(PDO::FETCH_ASSOC))
{
echo "<tr>
<td>" . $row['Marka'] ."</td>
<td>" . $row['Model'] ."</td>
<td>" . $row['Yil'] ."</td>
<td>" . $row['Yakit_Durumu'] ."</td>
<td>" . $row['Hasar_Kaydi'] ."</td>
</tr>";
}
echo "</table>";
?>)

