herkese selamlar kolay gelsin dostlar
localhosttan sayfa boş geliyor neden boş geldiğini biliyorum altta gördüğünüz switch case den dolayı switch sildiğimde hersey normale dönüyor
switc case yi silmeden bu hatayı nasıl düzelte bilirim şimdiden zaman ayırıp yardım eden herkese teşekkürler..
<?php include("fonksiyon.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="dosya/boost.css" >
<title>PDO ÜYELİK SİSTEMİ</title>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-6 mx-auto mt-4" >
<?php
$hareket=$_GET["hareket"];
switch($hareket):
case"ekle":
break;
case"uyeguncelle":
break;
case"uyesil":
break;
?>
<table class="table table-bordered table-striped text-center bg-white">
<thead>
<tr>
<th colspan="6"> <a href="index.php?hareket=ekle" class="btn btn-success"> Üye Ekle </a></th>
</tr>
</thead>
<thead>
<tr>
<th class="font-weight-bold">AD</th>
<th class="font-weight-bold">SOYAD</th>
<th class="font-weight-bold">YAŞ</th>
<th class="font-weight-bold">AİDAT</th>
<th class="font-weight-bold">GÜNCELLE</th>
<th class="font-weight-bold">SİL</th>
</tr>
</thead>
<tbody>
<?php
$clas= new uye;
echo $clas->listele($baglanti);
?>
</tbody>
</table>
<?php
default;
endswitch;
?>
</div>
</div>
</div>
</body>
</html> fonsiyon .php
<?php
try {
$baglanti = new PDO("mysql:host=localhost;dbname=kisiler;charset=utf8", "root","123456");
$baglanti->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
die($e->getMessege());
}
class uye {
function ekle ($baglanti){
$buton=$_POST["buton"];
if($buton):
$ad= htmlspecialchars ($_POST["ad"]);
$soyad= htmlspecialchars ($_POST["soyad"]);
$yas= htmlspecialchars ($_POST["yas"]);
$aidat=htmlspecialchars($_POST["aidat"]);
if (empty ($ad) or empty ($soyad) or empty ($yas) or empty ($aidat) ):
echo"boş alan bırakma ";
else:
$ekleme=$baglanti->prepare("insert into uyeler (ad,soyad,yas,aidat) VALUES(?,?,?,?)");
$ekleme->bindParam(1,$ad,PDO::PARAM_STR);
$ekleme->bindParam(1,$soyad,PDO::PARAM_STR);
$ekleme->bindParam(1,$yas,PDO::PARAM_STR);
$ekleme->bindParam(1,$aidat,PDO::PARAM_INT);
$ekleme->execute();
echo "ekleme başarılı ";
endif;
endif;
echo '<table class="table table-border table-striped text-center bg-white">
<thead>
<tr>
<th colspan="6">Üye Ekleme</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="6">
<form action="inde.php?islem=ekle" method="post">
<input type="text" name="ad" class="form-control mx-auto col-md-3 mt-2" placeholder="ad yaz" />
<input type="text" name="soyad" class="form-control mx-auto col-md-3 mt-2" placeholder="soyad yaz" />
<input type="text" name="yas" class="form-control mx-auto col-md-3 mt-2" placeholder="yas yaz" />
<input type="text" name="aidat" class="form-control mx-auto col-md-3 mt-2" placeholder="aidat yaz" />
<input type="submit" name="buton" class="btn btn-success" value="EKLE" />
</form>
</td>
<tr>
</tbody>
</table>';
}
function listele($baglanti){
$sorgu=$baglanti->prepare("select * from uyeler") ;
$sorgu->execute();
if($sorgu->rowCount()==0):
echo'<tr>
<td colspan="6"> Kayıtlı Üye Yok</td>
</tr>';
else:
while ($cikti=$sorgu->fetch(PDO::FETCH_ASSOC)):
echo ' <tr>
<td>'.$cikti["ad"].'</td>
<td>'.$cikti["soyad"].'</td>
<td>'.$cikti["yas"].'</td>
<td>'.$cikti["aidat"].'</td>
<td><a href="index.php?hareket=uyeguncelle&id='.$cikti["id"].'" class="btn btn-warning" >Güncelle </a> </td>
<td><a href="index.php?hareket=uyesil&id='.$cikti["id"].'" class="btn btn-danger" >Sil </a></td>
</tr>';
endwhile;
endif;
}
}
?>