ldoozer Posted December 31, 2007 Share Posted December 31, 2007 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 https://forums.phpfreaks.com/topic/83859-adding-editing-and-deleting-lines-in-an-xml-file/ Share on other sites More sharing options...
rondog Posted December 31, 2007 Share Posted December 31, 2007 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 https://forums.phpfreaks.com/topic/83859-adding-editing-and-deleting-lines-in-an-xml-file/#findComment-426831 Share on other sites More sharing options...
ldoozer Posted January 1, 2008 Author Share Posted January 1, 2008 thanks thats a great start - will give it a try and see if i can expand on it. Link to comment https://forums.phpfreaks.com/topic/83859-adding-editing-and-deleting-lines-in-an-xml-file/#findComment-427251 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.