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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.