Warning: Undefined array key "btn_ekle" in C:\xampp\htdocs\yu.php on line 2
Warning: Undefined array key "sil" in C:\xampp\htdocs\yu.php on line 22
bu hataları nasıl giderebilirim <?php
if($_POST['btn_ekle']){
if(!empty($_POST['numara']) and
!empty($_POST['ad_soyad']) and
!empty($_POST['not1']) and !empty($_POST['not2'])){
$dosya = fopen('ogr.txt','a+');
fwrite($dosya, $_POST['numara'].'|'.
$_POST['ad_soyad'].'|'.$_POST['not1'].
'|'.$_POST['not2']."\r\n");
fclose($dosya);
}
}
$okunan=file('ogr.txt');
$k=0;
foreach($okunan as $sira => $satir){
$data=explode('|',$satir);
$numara[$k]=substr($satir,0,strpos($satir,'|'));
$k++;
}
if($_GET['sil']){
$indis = array_search($_GET['sil'], $numara);
if($indis>=0){
unset($okunan[$indis]);
$ac = fopen('ogr.txt','w+');
foreach($okunan as $sira => $satir){
fwrite($ac,$satir);
}
fclose($ac);
}
}
?>
<!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" xml:lang="en">
<head>
<meta scrip."Content-Type" content="text/html;charset=UTF-8"/>
<title>Öğrenci Bilgileri</title>
</head>
<body>
<form method="post">
numara : <input type="text" name="numara"/>
adi soyadi : <input type="text" name="ad_soyad"/>
not 1 : <input type="text" name="not1"/>
not 2 : <input type="text" name="not2"/>
<input type="submit" name="btn_ekle" value="Ekle">
</form>
<br><br>
<table border="1" cellpadding="3" cellspacing="0">
<tr>
<td align="center"><b>no</b></td>
<td align="center"><b>ad soyad</b></td>
<td align="center"><b>not 1</b></td>
<td align="center"><b>not 2</b></td>
<td align="center"><b>Silme</b></td>
</tr>
<?Php
$dosyaismi="ogr.txt";
$okunan=file($dosyaismi);
foreach($okunan as $sira => $satir)
{
$veri = explode('|',$satir);
echo '<tr>';
echo '<td>'.$veri[0].'</td>';
echo '<td>'.$veri[1].'</td>';
echo '<td>'.$veri[2].'</td>';
echo '<td>'.$veri[3].'</td>';
echo '<td><a target=_blank href="txt.php?sil='.$veri[0].'">
Sil</a></td>';
echo '</tr>';
}
?>
</table>
</body>
</html>