rendered paste body<?php
// Pfad zu deiner Quelldatei
$file = "linknx.xml";
// Pfad zu deiner Zieldatei
$savefile = "linknx.xml";
$xml = simplexml_load_file($file);
?>
<!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=iso-8859-1" />
<title>LINKNX Editor by David</title>
</head>
<body>
<?php
if (empty($_POST)) {
?>
<form action="<? echo $_SERVER['PHP_SELF']?>" method="post">
<?php
foreach ($xml->objects->children() as $node) {
$i++;
$id = $node["id"];
$gad = $node["gad"];
$init = $node["init"];
//
echo "<input name=\"id_$i\" type=\"text\" value=\"$id\" /> \n";
echo "<input name=\"gad_$i\" type=\"text\" value=\"$gad\" /> \n";
echo "<input name=\"init_$i\" type=\"text\" value=\"$init\" /> <br />\n<br />\n";
}
?>
<input type="submit" name="Submit" value="Speichern" />
</form>
</body>
</html>
<?php
} else {
foreach ($_POST as $key => $value) {
if($key != "Submit") {
$para = explode("_", $key);
$nr = $para[1];
$id = $para[0];
$xml->objects[$nr-1]->object[$name] = $value;
$xml->asXML($savefile);
}
}
echo "Datei unter <strong> $savefile </strong> gespeichert!\n";
echo "</body>\n";
echo "</html>";
}
?>