Jump to content

adding editing and deleting lines in an xml file


ldoozer

Recommended Posts

Hi all, I have a google map which is using an xml file to reference points on the map.

I would like to write a really simple admin page which allows anyone to add/edit/delete the points in the xml file.

 

the xml looks like this at the moment:

<markers>
<marker lat="53.404474" lng="-1.375171" html="<strong>Brinsworth and Catcliffe</strong><br>Pringle Road Brinsworth<br><a href="data_brinsworth.html">Annual Summary</a> " label="bc1" icontype="1"/>
</markers>

 

can anyone give me a clue?

 

Thank you

Steve

I'm in the first stages of making something similar. Basically I have a text area that displays whats currently in my XML file and then. I make the changes and it saves that data.

<?php
$page = $_SERVER['PHP_SELF'];
$submit = $_POST['Submit'];
$newdata = stripslashes($_POST['thexml']);
$filename = "gallery.xml";
if($submit) {
$handle = fopen($filename, 'w');
fwrite($handle, $newdata);
fclose($handle);
}

$content = file_get_contents($filename);

$form = "<form action=\"$page\" method=\"post\">";
$form .= "<textarea name=\"thexml\" cols=\"75\" rows=\"15\">$content</textarea>";
$form .= "<input type=\"submit\" name=\"Submit\" value=\"Submit\" />";
$form .= "</form>";
echo $form;
?>

 

It's not idiot proof yet as it will save bad xml syntax.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.