coldstone28
Mitglied
Bekomme aber immer noch dieselbe meldung.
PHP:
<?php
$fh = fopen("telefonliste.json", "a");
$txt = file_get_contents("telefonliste.json");
if($txt == "" or $txt == null) {
$list = array();
} else {
$list = json_decode($txt);
}
if(isset($_POST['Name'])) {
$list[] = array('Name' => $_POST['Name'],
'Name' => $_POST['Name']);
}
$txt = json_encode($list);
file_put_contents("telefonliste.json", $txt);
if(isset($_GET["delete"])) {
unset($list[$i]);
}
?>
.
.
.
<?php
$txt = file_get_contents('telefonliste.json');
$list = json_decode($txt, true);
$i=0;
foreach ($list as $entry) {
echo
'<li>
<span>' . $entry['name'] . '</span>
<span>' . $entry['nummer'] . '</span>
<a href="index.php?delete=' . $i . '" class="delete"löschen">löschen</a>
</li>';
$i++;}
?>